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 Objecttrait Matchableclass Any
- Self type
-
QueryMetaExtractor.type