final case class Query[A, B](sql: String, origin: Origin, encoder: Encoder[A], decoder: Decoder[B]) extends Statement[A] with Product with Serializable
SQL, parameter encoder, and row decoder for a statement that returns rows. We assume that sql
has the same number of placeholders of the form $1
, $2
, etc., as the number of slots encoded
by encoder
, that sql
selects the same number of columns are the number of slots decoded by
decoder
, and that the parameter and column types specified by encoder
and decoder
are
consistent with the schema. The check
methods on Session provide a means to
verify this assumption.
You can construct a Query
directly, although it is more typical to use the sql
interpolator.
sql"SELECT name, age FROM person WHERE age > $int2".query(varchar ~ int2) // Query[Short, String ~ Short]
- sql
A SQL statement returning no rows.
- origin
The
Origin
where the sql was defined, if any.- encoder
An encoder for all parameters
$1
,$2
, etc., insql
.- decoder
A decoder for selected columns.
- Source
- Query.scala
- See also
StringContextOps for information on the
sql
interpolator.Session for information on executing a
Query
.
- Grouped
- Alphabetic
- By Inheritance
- Query
- Serializable
- Product
- Equals
- Statement
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def contramap[C](f: (C) => A): Query[C, B]
Query is a contravariant functor in
A
. - val decoder: Decoder[B]
- def dimap[C, D](f: (C) => A)(g: (B) => D): Query[C, D]
Query is a profunctor.
- val encoder: Encoder[A]
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def gcontramap[C](implicit ev: Aux[C, A]): Query[C, B]
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def gmap[D](implicit ev: Aux[D, B]): Query[A, D]
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def map[D](g: (B) => D): Query[A, D]
Query is a covariant functor in
B
. - final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- val origin: Origin
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- val sql: String
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()