Reputation: 838
I have a query like this:
def getLatest( limit:Short, v:Rep[String] ) = ( for {
(_,r) <- T1 join T2 on ( _.id === _.foreingId )
} yield r ).take( limit )
I can't make a "Compiled" value from this query because of "limit" ( A non Rep attribute in in argument-list ). What can I do in this case?
Upvotes: 1
Views: 646
Reputation: 838
You shoukd use ConstColumn[_]
( http://slick.typesafe.com/doc/3.1.0/queries.html#compiled-queries ) :
def getLatest( limit:ConstColumn[Long], v:Rep[String] ) = ( for {
(_,r) <- T1 join T2 on ( _.id === _.foreingId )
} yield r ).take( limit )
val compiled = Compiled( getLatest _ ) // compiled( 10, "Hello" )
Upvotes: 2