postgresql - Scala Slick delete not working -
when deleting tablequery object should able write:
facebookauths.delete
but it's complaining delete isn't method in tablequery, if try:
users.filter(_.id === 1337).delete
it's still saying delete isn't method, on query object.
what doing wrong? imports are:
import scala.slick.lifted._ import scala.slick.driver.jdbcdriver.simple._
and other things firstoption works.
i use postgres.
thanks!
you using postgres
, need import scala.slick.driver.postgresdriver.simple._
, scala.slick.driver.postgresdriver
instead of jdbc
ones, same thing applies schema defined.
edit:
this bit outside knowledge , i'm not 100% sure give try.
the postgresdriver
trait extends jdbcdriver
trait (from jdbcprofile.scala
), trait signature:
trait postgresdriver extends jdbcdrive
and in turn jdbcdriver
extends sqldriver
:
trait jdbcdriver extends sqldriver
the firstoption
method belongs unitinvoker
trait, it's not dependent imported drivers, same thing applies list
, first
, other methods, can check them in invoker.scala
file. delete
method instead defined in deleteinvoker
class inside jdbcinvokercomponent
trait.
my understanding when declaring tablequery
object full signature:
val table: postgresdriver.simple.tablequery[mytable] = tablequery[mytable]
while declaring table signature:
val table: jdbcdriver.simple.tablequery[mytable] = tablequery[mytable]
i don't know why delete
method not available jdbc
directly, have use query
, use query.deleteinvoker
, said i'm not sure, looks confusing me too.
Comments
Post a Comment