sealed abstract class Query[-In, +Out] extends Serializable
Query is a description of computations you want to perform on your data. It doesn't evaluate until you explicitly run it.
- In
query input, e.g. type of the data source
- Out
query computation result type
- Alphabetic
- By Inheritance
- Query
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def explain: QueryExplain
Provides information about the query "plan".
Provides information about the query "plan".
- returns
the query plain
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ++[In2 <: In, Out0 >: Out](that: Query[In2, Out0])(implicit arg0: scalaql.Tag[In2], arg1: scalaql.Tag[Out0]): Query[In2, Out0]
Symbolic alias for
union
Symbolic alias for
union
- See also
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def >>>[Out0 >: Out, Out2](that: Query[From[Out0], Out2])(implicit arg0: scalaql.Tag[Out0], arg1: scalaql.Tag[Out2]): Query[In, Out2]
Symbolic alias for
andThen
Symbolic alias for
andThen
- See also
- def accumulate[S, B](initialState: S)(modifyState: (S, Out) => S)(getResults: (S) => Iterable[B])(implicit arg0: scalaql.Tag[S], arg1: scalaql.Tag[B]): Query[In, B]
Accumulates all of the query values into a state, producing records based on that state.
Accumulates all of the query values into a state, producing records based on that state.
- S
accumulation state type
- B
accumulation result type
- initialState
the initial state for accumulation
- modifyState
updates state by applying query output value
- getResults
extract records from the state
- returns
transformed query
- Note
should be used only for complicated computations if no equivalent exist. Accumulating query emits value only after processing the whole input! Example:
val uniqueSkills = select[Person] .accumulate(initialState = Set.empty[Skill])( (skillSet, person) => skillSet ++ person.skills )(_.toList)
- def andThen[Out0 >: Out, Out2](that: Query[From[Out0], Out2])(implicit arg0: scalaql.Tag[Out0], arg1: scalaql.Tag[Out2]): Query[In, Out2]
Produces a query which uses
this
query input by producing output of the specified query.Produces a query which uses
this
query input by producing output of the specified query. Allows functional composition of multiple queries.Example:
val peopleSkills = select[Person].mapConcat(_.skills).distinct val programmingSkills = select[Skill].where(_.isProgrammingSkill) val result = peopleSkills >>> programmingSkills
- Out0
inferred common output type for this query and the transformed result query
- Out2
new query output type
- that
query for which to feed
this
query output- returns
a composition of
this
andthat
query
- 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 collect[B](pf: PartialFunction[Out, B])(implicit arg0: scalaql.Tag[B]): Query[In, B]
Transforms the query output by applying an arbitrary partial function to previous query step.
Transforms the query output by applying an arbitrary partial function to previous query step.
Used to apply transformation and filtering in one step.
Example:
select[Person].collect { case person if person.age >= 18 => person.name }
- B
new query output type
- pf
transformation function
- returns
transformed query
- def deduplicate: Query[In, Out]
Produces only unique values.
- def deduplicateBy[K](f: (Out) => K)(implicit arg0: scalaql.Tag[K]): Query[In, Out]
Produces only unique values based on the given deduplication key.
Produces only unique values based on the given deduplication key.
Example:
select[Person].deduplicateBy(_.name)
- K
deduplication key type
- f
extracts deduplication key
- returns
the same query with only unique values
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def flatMap[In2 <: In, B](f: (Out) => Query[In2, B])(implicit arg0: scalaql.Tag[In2], arg1: scalaql.Tag[B]): Query[In2, B]
Transforms the query output by applying an arbitrary function which produces a new Query based on the previous step.
Transforms the query output by applying an arbitrary function which produces a new Query based on the previous step.
Example:
select[Employee] .flatMap { employee => select[Skill].where(_.name isInCollection employee.skills) }
- In2
inferred common input type for this query and the transformed result query
- B
new query output type
- f
transformation function
- returns
transformed query
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def groupBy[A, B, C](f: scalaql.GroupBy[Out, A], g: scalaql.GroupBy[Out, B], h: scalaql.GroupBy[Out, C])(implicit arg0: scalaql.Tag[A], arg1: scalaql.Tag[B], arg2: scalaql.Tag[C]): GroupByQuery[In, Out, (A, B, C)]
Entrypoint for performing aggregations on this query.
Entrypoint for performing aggregations on this query.
- A
the first grouping key type
- B
the second grouping key type
- C
the third grouping key type
- f
extracts the first grouping key
- g
extracts the second grouping key
- h
extracts the third grouping key
- def groupBy[A, B](f: scalaql.GroupBy[Out, A], g: scalaql.GroupBy[Out, B])(implicit arg0: scalaql.Tag[A], arg1: scalaql.Tag[B]): GroupByQuery[In, Out, (A, B)]
Entrypoint for performing aggregations on this query.
Entrypoint for performing aggregations on this query.
- A
the first grouping key type
- B
the second grouping key type
- f
extracts the first grouping key
- g
extracts the second grouping key
- def groupBy[A](f: scalaql.GroupBy[Out, A])(implicit arg0: scalaql.Tag[A]): GroupByQuery[In, Out, A]
Entrypoint for performing aggregations on this query.
Entrypoint for performing aggregations on this query.
- A
grouping key type
- f
extracts grouping key
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def map[B](f: (Out) => B)(implicit arg0: scalaql.Tag[B]): Query[In, B]
Transforms the query output by applying an arbitrary function to previous query step.
Transforms the query output by applying an arbitrary function to previous query step.
Example:
select[Person].map(_.age)
- B
new query output type
- f
transformation function
- returns
transformed query
- def mapConcat[B](f: (Out) => Iterable[B])(implicit arg0: scalaql.Tag[B]): Query[In, B]
Transforms the query output by applying an arbitrary function to previous query step.
Transforms the query output by applying an arbitrary function to previous query step.
Unlike
map
, expects a transformation which produces multiple results.Example:
select[Employee].mapConcat(_.skills)
- B
new query output type
- f
transformation function
- returns
transformed query
- 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()
- def statefulMap[S, B](initialState: S)(process: (S, Out) => (S, B))(implicit arg0: scalaql.Tag[S], arg1: scalaql.Tag[B]): Query[In, B]
Transforms the query output by applying an arbitrary stateful function to previous query step.
Transforms the query output by applying an arbitrary stateful function to previous query step.
Unlike
map
, each output value depends on previously computed state.- S
accumulation state type
- B
accumulation result type
- initialState
the initial state for accumulation
- process
computes output value based on the input value and state
- returns
transformed query
- def statefulMapConcat[S, B](initialState: S)(process: (S, Out) => (S, Iterable[B]))(implicit arg0: scalaql.Tag[S], arg1: scalaql.Tag[B]): Query[In, B]
Transforms the query output by applying an arbitrary stateful function to previous query step.
Transforms the query output by applying an arbitrary stateful function to previous query step.
Unlike
statefulMap
, expects a stateful transformation which produces multiple results.- S
accumulation state type
- B
accumulation result type
- initialState
the initial state for accumulation
- process
computes output value based on the input value and state
- returns
transformed query
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- final def toString(): String
- Definition Classes
- Query → AnyRef → Any
- def union[In2 <: In, Out0 >: Out](that: Query[In2, Out0])(implicit arg0: scalaql.Tag[In2], arg1: scalaql.Tag[Out0]): Query[In2, Out0]
Produces a query which emits results from both
this
and the specified new query.Produces a query which emits results from both
this
and the specified new query.- In2
inferred common input type for this query and the transformed result query
- Out0
inferred common output type for this query and the transformed result query
- that
query to union with
- returns
union of
this
andthat
query
- Note
the current implementation of union first produces all the results of
this
query, and then results of the specified query. But this behavior may change in future
- 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()
- def where(p: scalaql.Predicate[Out]): Query[In, Out]
Filters records by specified predicate function.
Filters records by specified predicate function.
Example:
select[Person].where(_.age >= 18)
- p
predicate
- returns
query producing only elements for which the given predicate holds
- def whereNot(p: scalaql.Predicate[Out]): Query[In, Out]
An equivalent
where(!p)
.An equivalent
where(!p)
.- See also
- def whereSubQuery[In2 <: In](p: (Out) => QueryResult[In2, Boolean])(implicit arg0: scalaql.Tag[In2]): Query[In2, Out]
Filters records by a predicate which depends on the result of other query.
Filters records by a predicate which depends on the result of other query.
Example:
select[Person] .whereSubQuery(person => select[Employee].exists(_.personId == person.id) )
- In2
inferred common input type for this query and the transformed result query
- p
predicate
- returns
query producing only elements for which the given predicate holds
- def withFilter(p: scalaql.Predicate[Out]): Query[In, Out]
- See also