I want to use MappedTo [String] as one type of column. There is one query, for example, to select some entries.
Code example:
case class ID(value: String) extends scala.slick.lifted.MappedTo[String]
class Order(tag: Tag) extends Table[(ID, String)](tag, "order") {
def id = column[ID]("id", O.PrimaryKey)
def name = column[String]("name", O.NotNull)
def * = (id, name)
}
val ordres = TableQuery[Order]
def all(implicit session: Session) = {
ordres.filter(_.id like "2014.%").list
}
Compiler Error:
[error] value like is not a member of scala.slick.lifted.Column[models.ID]
[error] ordres.filter(_.id like "2014.%").list
[error] ^
[error] ambiguous implicit values:
[error] both value BooleanColumnCanBeQueryCondition in object CanBeQueryCondition of type => scala.slick.lifted.CanBeQueryCondition[scala.slick.lifted.Column[Boolean]]
[error] and value BooleanOptionColumnCanBeQueryCondition in object CanBeQueryCondition of type => scala.slick.lifted.CanBeQueryCondition[scala.slick.lifted.Column[Option[Boolean]]]
[error] match expected type scala.slick.lifted.CanBeQueryCondition[Nothing]
[error] ordres.filter(_.id like "2014.%").list
How to fix it? Thank.
source
share