user1498572
user1498572

Reputation: 543

Slick: Put model case classes in separate object using code generator

I am using the slick code generator, I have everything in a trait, but I would like to separate the case classes representing my actual model from all the slick query / table classes.

That would look like

object Models {
  case class Foo(bar: String)
}

trait SlickTables {
  import Models.Foo
  class Foos(tag: Tag) extends Table[Foo](tag, "foo") {
    ...
  }
}

Is there any way to do this by tweaking the code generator ?

Upvotes: 2

Views: 228

Answers (1)

noru
noru

Reputation: 526

Just figure a way out.

https://gist.github.com/noru/fd32b03947290176aa36

Around line 80

Upvotes: 0

Related Questions