Query

slick.lifted.Query
See theQuery companion object
abstract class Query[+E, U, C[_]] extends QueryBase[C[U]]

An instance of Query represents a query or view, i.e. a computation of a collection type (Rep[Seq[T]]). It is parameterized with both, the mixed type (the type of values you see e.g. when you call map()) and the unpacked type (the type of values that you get back when you run the query).

Additional extension methods for queries containing a single column are defined in slick.lifted.SingleColumnQueryExtensionMethods.

Attributes

Companion:
object
Source:
Query.scala
Graph
Supertypes
trait QueryBase[C[U]]
trait Rep[C[U]]
class Object
trait Matchable
class Any
Known subtypes
class TableQuery[E]
class WrappingQuery[E, U, C]
class BaseJoinQuery[E1, E2, U1, U2, C, B1, B2]
class ForeignKeyQuery[E, U]
Self type
Query[E, U, C]

Members list

Concise view

Value members

Abstract methods

def shaped: ShapedValue[_ <: E, U]

Attributes

Source:
Query.scala

Concrete methods

def ++[O >: E, R, D[_]](other: Query[O, U, D]): Query[O, U, C]

Return a new query containing the elements from both operands. Duplicate elements are preserved.

Return a new query containing the elements from both operands. Duplicate elements are preserved.

Attributes

Source:
Query.scala
def countDistinct: Rep[Int]

The number of distinct elements of the query.

The number of distinct elements of the query.

Attributes

Source:
Query.scala
def distinct: Query[E, U, C]

Remove duplicate elements. When used on an ordered Query, there is no guarantee in which order duplicates are removed. This method is equivalent to distinctOn(identity).

Remove duplicate elements. When used on an ordered Query, there is no guarantee in which order duplicates are removed. This method is equivalent to distinctOn(identity).

Attributes

Source:
Query.scala
def distinctOn[F, T](f: E => F)(implicit shape: Shape[_ <: FlatShapeLevel, F, T, _]): Query[E, U, C]

Remove duplicate elements which are the same in the given projection. When used on an ordered Query, there is no guarantee in which order duplicates are removed.

Remove duplicate elements which are the same in the given projection. When used on an ordered Query, there is no guarantee in which order duplicates are removed.

Attributes

Source:
Query.scala
def drop(num: ConstColumn[Long]): Query[E, U, C]

Select all elements except the first num ones.

Select all elements except the first num ones.

Attributes

Source:
Query.scala
def drop(num: Long): Query[E, U, C]

Select all elements except the first num ones.

Select all elements except the first num ones.

Attributes

Source:
Query.scala
def drop(num: Int): Query[E, U, C]

Select all elements except the first num ones.

Select all elements except the first num ones.

Attributes

Source:
Query.scala
def encodeRef(path: Node): Query[E, U, C]

Encode a reference into this Rep.

Encode a reference into this Rep.

Attributes

Source:
Query.scala
def exists: Rep[Boolean]

Test whether this query is non-empty.

Test whether this query is non-empty.

Attributes

Source:
Query.scala
def filter[T](f: E => T)(implicit wt: CanBeQueryCondition[T]): Query[E, U, C]

Select all elements of this query which satisfy a predicate. Unlike withFilter, this method only allows Rep-valued predicates, so it guards against the accidental use plain Booleans.

Select all elements of this query which satisfy a predicate. Unlike withFilter, this method only allows Rep-valued predicates, so it guards against the accidental use plain Booleans.

Attributes

Source:
Query.scala
def filterIf[T : CanBeQueryCondition](p: Boolean)(f: E => T): Query[E, U, C]

Applies the given filter function, if the boolean parameter p evaluates to true. If not, the filter will not be part of the query.

Applies the given filter function, if the boolean parameter p evaluates to true. If not, the filter will not be part of the query.

Attributes

Source:
Query.scala
def filterNot[T](f: E => T)(implicit wt: CanBeQueryCondition[T]): Query[E, U, C]

Attributes

Source:
Query.scala
def filterNotIf[T : CanBeQueryCondition](p: Boolean)(f: E => T): Query[E, U, C]

Applies the given filterNot function, if the boolean parameter p evaluates to true. If not, the filter will not be part of the query.

Applies the given filterNot function, if the boolean parameter p evaluates to true. If not, the filter will not be part of the query.

Attributes

Source:
Query.scala
def filterNotOpt[V, T : CanBeQueryCondition](optValue: Option[V])(f: (E, V) => T): Query[E, U, C]

Applies the given filterNot, if the Option value is defined. If the value is None, the filter will not be part of the query.

Applies the given filterNot, if the Option value is defined. If the value is None, the filter will not be part of the query.

Attributes

Source:
Query.scala
def filterOpt[V, T : CanBeQueryCondition](optValue: Option[V])(f: (E, V) => T): Query[E, U, C]

Applies the given filter, if the Option value is defined. If the value is None, the filter will not be part of the query.

Applies the given filter, if the Option value is defined. If the value is None, the filter will not be part of the query.

Attributes

Source:
Query.scala
def flatMap[F, T, D[_]](f: E => Query[F, T, D]): Query[F, T, C]

Build a new query by applying a function to all elements of this query and using the elements of the resulting queries. This corresponds to an implicit inner join in SQL.

Build a new query by applying a function to all elements of this query and using the elements of the resulting queries. This corresponds to an implicit inner join in SQL.

Attributes

Source:
Query.scala
def forUpdate: Query[E, U, C]

Specify part of a select statement for update and marked for row level locking

Specify part of a select statement for update and marked for row level locking

Attributes

Source:
Query.scala
def groupBy[K, T, G, P](f: E => K)(implicit kshape: Shape[_ <: FlatShapeLevel, K, T, G], vshape: Shape[_ <: FlatShapeLevel, E, _, P]): Query[(G, Query[P, U, Seq]), (T, Query[P, U, Seq]), C]

Partition this query into a query of pairs of a key and a nested query containing the elements for the key, according to some discriminator function.

Partition this query into a query of pairs of a key and a nested query containing the elements for the key, according to some discriminator function.

Attributes

Source:
Query.scala
def join[E2, U2, D[_]](q2: Query[E2, U2, D]): BaseJoinQuery[E, E2, U, U2, C, E, E2]

Join two queries with a cross join or inner join. An optional join predicate can be specified later by calling on.

Join two queries with a cross join or inner join. An optional join predicate can be specified later by calling on.

Attributes

Source:
Query.scala
def joinFull[E1 >: E, E2, U2, D[_], O1, U1, O2](q2: Query[E2, _, D])(implicit ol1: OptionLift[E1, O1], sh1: Shape[FlatShapeLevel, O1, U1, _], ol2: OptionLift[E2, O2], sh2: Shape[FlatShapeLevel, O2, U2, _]): BaseJoinQuery[O1, O2, U1, U2, C, E, E2]

Join two queries with a full outer join. An optional join predicate can be specified later by calling on. Both sides of the join are lifted to an Option. If at least one element on either side matches the other side, all matching elements are returned as Some, otherwise a single None row is returned.

Join two queries with a full outer join. An optional join predicate can be specified later by calling on. Both sides of the join are lifted to an Option. If at least one element on either side matches the other side, all matching elements are returned as Some, otherwise a single None row is returned.

Attributes

Source:
Query.scala
def joinLeft[E2, U2, D[_], O2](q2: Query[E2, _, D])(implicit ol: OptionLift[E2, O2], sh: Shape[FlatShapeLevel, O2, U2, _]): BaseJoinQuery[E, O2, U, U2, C, E, E2]

Join two queries with a left outer join. An optional join predicate can be specified later by calling on. The right side of the join is lifted to an Option. If at least one element on the right matches, all matching elements are returned as Some, otherwise a single None row is returned.

Join two queries with a left outer join. An optional join predicate can be specified later by calling on. The right side of the join is lifted to an Option. If at least one element on the right matches, all matching elements are returned as Some, otherwise a single None row is returned.

Attributes

Source:
Query.scala
def joinRight[E1 >: E, E2, U2, D[_], O1, U1](q2: Query[E2, U2, D])(implicit ol: OptionLift[E1, O1], sh: Shape[FlatShapeLevel, O1, U1, _]): BaseJoinQuery[O1, E2, U1, U2, C, E, E2]

Join two queries with a right outer join. An optional join predicate can be specified later by calling on. The left side of the join is lifted to an Option. If at least one element on the left matches, all matching elements are returned as Some, otherwise a single None row is returned.

Join two queries with a right outer join. An optional join predicate can be specified later by calling on. The left side of the join is lifted to an Option. If at least one element on the left matches, all matching elements are returned as Some, otherwise a single None row is returned.

Attributes

Source:
Query.scala
def length: Rep[Int]

The total number of elements (i.e. rows).

The total number of elements (i.e. rows).

Attributes

Source:
Query.scala
def map[F, G, T](f: E => F)(implicit shape: Shape[_ <: FlatShapeLevel, F, T, G]): Query[G, T, C]

Build a new query by applying a function to all elements of this query.

Build a new query by applying a function to all elements of this query.

Attributes

Source:
Query.scala
def pack[R](implicit packing: Shape[_ <: FlatShapeLevel, E, _, R]): Query[R, U, C]

Attributes

Source:
Query.scala
def size: Rep[Int]

The total number of elements (i.e. rows).

The total number of elements (i.e. rows).

Attributes

Source:
Query.scala
def sortBy[T](f: E => T)(implicit ev: T => Ordered): Query[E, U, C]

Sort this query according to a function which extracts the ordering criteria from the query's elements.

Sort this query according to a function which extracts the ordering criteria from the query's elements.

Attributes

Source:
Query.scala
def sorted(implicit ev: E => Ordered): Query[E, U, C]

Sort this query according to a the ordering of its elements.

Sort this query according to a the ordering of its elements.

Attributes

Source:
Query.scala
def subquery: Query[E, U, C]

Force a subquery to be created when using this Query as part of a larger Query. This method should never be necessary for correctness. If a query works with an explicit .subquery call but fails without, this should be considered a bug in Slick. The method is exposed in the API to enable workarounds to be written in such cases.

Force a subquery to be created when using this Query as part of a larger Query. This method should never be necessary for correctness. If a query works with an explicit .subquery call but fails without, this should be considered a bug in Slick. The method is exposed in the API to enable workarounds to be written in such cases.

Attributes

Source:
Query.scala
def take(num: ConstColumn[Long]): Query[E, U, C]

Select the first num elements.

Select the first num elements.

Attributes

Source:
Query.scala
def take(num: Long): Query[E, U, C]

Select the first num elements.

Select the first num elements.

Attributes

Source:
Query.scala
def take(num: Int): Query[E, U, C]

Select the first num elements.

Select the first num elements.

Attributes

Source:
Query.scala
def to[D[_]](implicit ctc: TypedCollectionTypeConstructor[D]): Query[E, U, D]

Change the collection type to build when executing the query.

Change the collection type to build when executing the query.

Attributes

Source:
Query.scala
def union[O >: E, R, D[_]](other: Query[O, U, D]): Query[O, U, C]

Return a new query containing the elements from both operands. Duplicate elements are eliminated from the result.

Return a new query containing the elements from both operands. Duplicate elements are eliminated from the result.

Attributes

Source:
Query.scala
def unionAll[O >: E, R, D[_]](other: Query[O, U, D]): Query[O, U, C]

Return a new query containing the elements from both operands. Duplicate elements are preserved.

Return a new query containing the elements from both operands. Duplicate elements are preserved.

Attributes

Source:
Query.scala
def withFilter[T : CanBeQueryCondition](f: E => T): Query[E, U, C]

Select all elements of this query which satisfy a predicate. This method is used when desugaring for-comprehensions over queries. There is no reason to call it directly because it is the same as filter.

Select all elements of this query which satisfy a predicate. This method is used when desugaring for-comprehensions over queries. There is no reason to call it directly because it is the same as filter.

Attributes

Source:
Query.scala
def zip[E2, U2, D[_]](q2: Query[E2, U2, D]): Query[(E, E2), (U, U2), C]

Return a query formed from this query and another query by combining corresponding elements in pairs.

Return a query formed from this query and another query by combining corresponding elements in pairs.

Attributes

Source:
Query.scala
def zipWith[E2, U2, F, G, T, D[_]](q2: Query[E2, U2, D], f: (E, E2) => F)(implicit shape: Shape[_ <: FlatShapeLevel, F, T, G]): Query[G, T, C]

Return a query formed from this query and another query by combining corresponding elements with the specified function.

Return a query formed from this query and another query by combining corresponding elements with the specified function.

Attributes

Source:
Query.scala
def zipWithIndex: BaseJoinQuery[E, Rep[Long], U, Long, C, E, Rep[Long]]

Zip this query with its indices (starting at 0).

Zip this query with its indices (starting at 0).

Attributes

Source:
Query.scala

Inherited methods

Get the Node for this Rep.

Get the Node for this Rep.

Attributes

Inherited from:
Rep
Source:
Rep.scala
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns:

a string representation of the object.

Definition Classes
Rep -> Any
Inherited from:
Rep
Source:
Rep.scala

Concrete fields

final lazy val packed: Node

Attributes

Source:
Query.scala