In previous versions of Slick, there was an insert function defined in TableQuery that returned the result of the insert. I go over to the new API and do something like:
DBIO.seq(someTable += someValue)
but it has a type
dbio.DBIOAction[Unit, NoStream, Write]
How can I return the affected rows?
change
The problem here is that the types do not line up as I expected. Here Scala sees types as:
val q: PostgresDriver.DriverAction[PostgresDriver.InsertActionExtensionMethods[(String, String)]
val seq: dbio.DBIOAction[Unit, NoStream, Write] = DBIO.seq(q)
db.run(seq)
That doesn't make sense to me. If it qhas a type DriverAction[PostgresDriver.InsertActionExtensionMethods[(String, String)]#SingleInsertResult...where SingleInsertResult is a type alias Int, then mine DBIO.seqshould not return a DBIOAction[Int, NoStream, Write]?
source
share