QueryMetaExtractor

io.getquill.context.QueryMetaExtractor

A QueryMeta allows contra-mapping some Query[T] to a combination of a Query[R] and then an extractor R => T. That is to say a function Query[T] => Query[R] and R => T function is automatically swapped in for a Query[T].

Internally, we use the term 'quip' (i.e. query + flip) to mean the QueryMeta construct, The Query[T] => Query[R] function itself is called the Quipper. Since a QueryMeta comes with an R=>M contramap function to apply to an extractor we call that the 'baq' since it mapps the inner query back from R to T.

Once the quip is summoned, it is applied to the original user-created query and then called a requip (i.e. re-applied quip). That it to say the requip is: FunctionApply(Query[T] => Query[R], Query[R])

Note that since internally, a QueryMeta carries a Quoted instance, the QueryMeta itself is a QuotationLot. For that reason, we call the whole QueryMeta structure a quip-lot. (Metaphorically speaking, a 'lot' meta real-estate containing a quip)

Given a PersonName(name: String) we can define a QueryMeta like this: {{ inline given QueryMeta[PersonName, String] = queryMeta( quote { (q: Query[PersonName]) => q.map(p => p.name) } // The Quipper )((name: String) => PersonName(name)) // The Baq }} When we do something like: {{ inline def people = quote { query[PersonName] } val result = ctx.run(people) }} The Query-Lot AST becomes EntityQuery("Person")

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

case class StaticRequip[T, R](requip: Expr[Quoted[Query[R]]], baq: Expr[R => T])

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def applyImpl[T : Type, R : Type, D <: Idiom : Type, N <: NamingStrategy : Type](quotedRaw: Expr[Quoted[Query[T]]], topLevelQuat: Quat)(implicit evidence$5: Type[T], evidence$6: Type[R], evidence$7: Type[D], evidence$8: Type[N], Quotes): (Expr[Quoted[Query[R]]], Expr[R => T], Option[StaticState])
def attemptStaticRequip[T : Type, R : Type](queryLot: QuotedExpr, queryLifts: List[PlanterExpr[_, _, _]], quip: Expr[QueryMeta[T, R]])(implicit evidence$3: Type[T], evidence$4: Type[R], Quotes): Option[StaticRequip[T, R]]
def summonQueryMeta[T : Type, R : Type](implicit evidence$1: Type[T], evidence$2: Type[R], Quotes): Option[Expr[QueryMeta[T, R]]]