Packages

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.

Self Type
Query[E, U, C]
Source
Query.scala
Linear Supertypes
QueryBase[C[U]], Rep[C[U]], AnyRef, Any
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Query
  2. QueryBase
  3. Rep
  4. AnyRef
  5. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Query()

Abstract Value Members

  1. abstract def shaped: ShapedValue[_ <: E, U]
  2. abstract def toNode: Node

    Get the Node for this Rep.

    Get the Node for this Rep.

    Definition Classes
    Rep

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from Query[E, U, C] toany2stringadd[Query[E, U, C]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ++[O >: E, R, D[_]](other: Query[O, U, D]): Query[O, U, C]

    Return a new query containing the elements from both operands.

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

  5. def ->[B](y: B): (Query[E, U, C], B)
    Implicit
    This member is added by an implicit conversion from Query[E, U, C] toArrowAssoc[Query[E, U, C]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  6. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
  9. def countDistinct: Rep[Int]

    The number of distinct elements of the query.

  10. def distinct: Query[E, U, C]

    Remove duplicate elements.

    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).

  11. 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.

    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.

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

    Select all elements except the first num ones.

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

    Select all elements except the first num ones.

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

    Select all elements except the first num ones.

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

    Encode a reference into this Rep.

    Encode a reference into this Rep.

    Definition Classes
    QueryRep
  16. def ensuring(cond: (Query[E, U, C]) => Boolean, msg: => Any): Query[E, U, C]
    Implicit
    This member is added by an implicit conversion from Query[E, U, C] toEnsuring[Query[E, U, C]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  17. def ensuring(cond: (Query[E, U, C]) => Boolean): Query[E, U, C]
    Implicit
    This member is added by an implicit conversion from Query[E, U, C] toEnsuring[Query[E, U, C]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  18. def ensuring(cond: Boolean, msg: => Any): Query[E, U, C]
    Implicit
    This member is added by an implicit conversion from Query[E, U, C] toEnsuring[Query[E, U, C]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  19. def ensuring(cond: Boolean): Query[E, U, C]
    Implicit
    This member is added by an implicit conversion from Query[E, U, C] toEnsuring[Query[E, U, C]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  20. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  22. def exists: Rep[Boolean]

    Test whether this query is non-empty.

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

    Select all elements of this query which satisfy a predicate.

    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.

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

    Applies the given filter function, if the boolean parameter p evaluates to true.

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

  25. def filterNot[T](f: (E) => T)(implicit wt: CanBeQueryCondition[T]): Query[E, U, C]
  26. def filterNotIf[T](p: Boolean)(f: (E) => T)(implicit arg0: CanBeQueryCondition[T]): Query[E, U, C]

    Applies the given filterNot function, if the boolean parameter p evaluates to true.

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

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

    Applies the given filterNot, if the Option value is defined.

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

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

    Applies the given filter, if the Option value is defined.

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

  29. 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.

    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.

  30. def forUpdate: Query[E, U, C]

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

  31. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  32. 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.

  33. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  34. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  35. 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.

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

  36. 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.

    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.

  37. 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.

    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.

  38. 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.

    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.

  39. def length: Rep[Int]

    The total number of elements (i.e.

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

  40. 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.

  41. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  42. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  43. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  44. def pack[R](implicit packing: Shape[_ <: FlatShapeLevel, E, _, R]): Query[R, U, C]
  45. final lazy val packed: Node
  46. def size: Rep[Int]

    The total number of elements (i.e.

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

  47. 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.

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

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

  49. def subquery: Query[E, U, C]

    Force a subquery to be created when using this Query as part of a larger Query.

    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.

  50. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  51. def take(num: Int): Query[E, U, C]

    Select the first num elements.

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

    Select the first num elements.

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

    Select the first num elements.

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

    Change the collection type to build when executing the query.

  55. def toString(): String
    Definition Classes
    Rep → AnyRef → Any
  56. 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.

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

  57. 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.

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

  58. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  59. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  60. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  61. def withFilter[T](f: (E) => T)(implicit arg0: CanBeQueryCondition[T]): Query[E, U, C]

    Select all elements of this query which satisfy a predicate.

    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.

  62. 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.

  63. 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.

  64. def zipWithIndex: BaseJoinQuery[E, Rep[Long], U, Long, C, E, Rep[Long]]

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

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

  2. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from Query[E, U, C] toStringFormat[Query[E, U, C]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.12.16) Use formatString.format(value) instead of value.formatted(formatString), or use the f"" string interpolator. In Java 15 and later, formatted resolves to the new method in String which has reversed parameters.

  3. def [B](y: B): (Query[E, U, C], B)
    Implicit
    This member is added by an implicit conversion from Query[E, U, C] toArrowAssoc[Query[E, U, C]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use -> instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.

Inherited from QueryBase[C[U]]

Inherited from Rep[C[U]]

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd fromQuery[E, U, C] to any2stringadd[Query[E, U, C]]

Inherited by implicit conversion StringFormat fromQuery[E, U, C] to StringFormat[Query[E, U, C]]

Inherited by implicit conversion Ensuring fromQuery[E, U, C] to Ensuring[Query[E, U, C]]

Inherited by implicit conversion ArrowAssoc fromQuery[E, U, C] to ArrowAssoc[Query[E, U, C]]

Ungrouped