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 dbioactions 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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -