scala - Like clause not working with int column in slick -
slick doesn't seem support clauses on int columns. following code status.code of int type doesn't seem work. there workaround this?
val query = { s <- status if s.code "1%" } yield (s)
can post status class definitation .if code type column[int] code should giving error works on column[string].
the below snippet works doing on integer field.
class coffees(tag: tag) extends table[(string, int)](tag, "coffees") { def name = column[string]("name") def status = column[int]("status") def * = (name,status) } this data insert , querying part
coffees ++= seq( ("colombian", 101), ("french_roast", 49), ("espresso", 150), ("colombian_decaf", 101), ("french_roast_decaf", 49) ) for( coffee <- coffees if coffee.status.ascolumnof[string] "1%" ) println(coffee)
Comments
Post a Comment