scala - How to create future unit? -
i have code:
def updatedocsetting(data: seq[modeldocumentsetting])= { (a <- data){ documentsettingtable .filter(_.doc_proc_list_id === a.doc_proc_list_id) .map(doc => (doc.is_mandatory,doc.is_display,doc.is_deleted)) .update(a.is_mandatory,a.is_display,a.is_deleted) } }
i have problem future slick result on service code service code
def updatedocsetting(data: list[modeldocumentsetting]): future[unit] = { db.run(daldocumentsetting.updatedocsetting(data)) }
error:type mismatch; found : unit required: slick.dbio.dbioaction[unit,slick.dbio.nostream,nothing]
you can convert sequence of dbioaction
s single dbioaction
using dbio.sequence
.
use yield
sequence of dbio actions:
(a <- data) yield { documentsettingtable .filter(_.doc_proc_list_id === a.doc_proc_list_id) .map(doc => (doc.is_mandatory,doc.is_display,doc.is_deleted)) .update(a.is_mandatory,a.is_display,a.is_deleted) }
and then:
db.run(dbio.sequence(daldocumentsetting.updatedocsetting(data)))
Comments
Post a Comment