1

I have the following in a library:

Case Class:

case class Foo(
  id: Option[Long],
  bar: Long
...
)

Table:

object Foos extends Mapper[Foo]("foo"){ //I'm using slick-inegration so the id is free
  def bar = column[Long]("bar")
  def cols = bar ~ ...
  def * = id.? ~: cols <> (Foo, Foo.unapply _)
  def returningId = cols returning id
  def insert(f: Foo)(implicit s: Session) = returningId.insert(Generic[Foo].to(f).tail.tupled)

...
}

The data access layer is set up in the binary that utilizes these models. If I try a comprehension such as "for(f<-Foos) yield f", inside of the Foos definition, we're happy. If I try it anywhere in the codebase which uses this library, I get:

value map is not a member of object DB.this.Foos

My guess is it's not getting lifted into a Query, but I'm not entirely sure. Any clarity would be appreciated.

kelf
  • 472
  • 4
  • 9

1 Answers1

1

Try doing:

  import slick.driver.MySQLDriver.simple._

or whichever driver it is that you need. You'll need the implicit classes in there to provide the map 'extension' method on Foos.

Erik Post
  • 826
  • 7
  • 12
  • This is the solution. Wish it was documented better :). Thanks! – kelf Sep 29 '13 at 01:02
  • You're welcome! Finding the right imports can be a bit of a pain in Scala sometimes, it would be cool if more examples actually listed them, but fortunately we have StackOverflow. ;) – Erik Post Sep 29 '13 at 20:23