Returns a Play JDBC context, able to apply function Database => A
.
Returns a Play JDBC context, able to apply function Database => A
.
The handler
is used to delegates query execution,
as soon as the statement is matching withQueryDetection
.
import acolyte.jdbc.{ QueryExecution, QueryResult } import acolyte.jdbc.Implicits._ import acolyte.jdbc.AcolyteDSL.handleStatement import acolyte.jdbc.play.PlayJdbcDSL.withPlayDB def aQueryResult: QueryResult = "lorem" val otherResult = "ipsum" withPlayDB( handleStatement withQueryHandler { (_: QueryExecution) => aQueryResult }) // With pattern matching ... import acolyte.jdbc.{ ExecutedParameter => P } def runner = withPlayDB(handleStatement withQueryHandler { _ match { case QueryExecution( "SELECT * FROM Test WHERE id = ?", P(1) :: Nil) => aQueryResult case _ => otherResult } }) runner { (_: play.api.db.Database) => // Any code using Play Database }
Returns a Play JDBC context, able to apply function Database => A
.
Returns a Play JDBC context, able to apply function Database => A
.
The result
is given to any query.
import acolyte.jdbc.QueryResult import acolyte.jdbc.Implicits._ import acolyte.jdbc.play.PlayJdbcDSL.withPlayDBResult def queryRes: QueryResult = "foo" val str: String = withPlayDBResult(queryRes) { _ => "str" }
Acolyte DSL for JDBC.