PlayJdbcDSL
acolyte.jdbc.play.PlayJdbcDSL$
object PlayJdbcDSL
Acolyte DSL for JDBC.
Attributes
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- PlayJdbcDSL.type
Members list
Concise view
Value members
Concrete methods
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
.
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
}
Attributes
Returns a Play JDBC context, able to apply function Database => A
.
The result
is given to any query.
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" }