Documentation ¶
Overview ¶
Package qry provide a way to work with external data, but can be used for local data as well. Backends provide model definitions and a way to evaluate queries to external data. The query environment detects query subjects and provides the planner for a program that manages query evaluation. Programs with queries take at least two evaluation passes. Each pass the resolved queries are planned as jobs for execution and all jobs from previous iterations are executed.
TODO: think about whether or how to support queries in loops
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Job ¶
Job describes a concrete query execution with all arguments evaluated.
type LitBackend ¶
func (*LitBackend) Proj ¶
func (b *LitBackend) Proj() *dom.Project
type Planner ¶
type Planner interface { // Prep returns a query with an unresolved subject for key or nil Prep(key string) *Query // Plan evaluates the query arguments or an error. // If all arguments are evaluated it returns a new job call or a zero literal if the query // can be ommited (e.g. when whr evaluates to false). Plan(p *exp.Prog, env exp.Env, c *exp.Call, q *Query) (exp.El, error) // Exec executes a job using the backend and returns the result. Exec(p *exp.Prog, j *Job) (lit.Lit, error) }
Planner is a program specific helper that manages available query backends.
type Query ¶
type Query struct { Kind Kind Ref string Subj typ.Type Sel *Sel Res typ.Type Whr []exp.El Lim int64 Off int64 Ord []Ord Planner Planner Model *dom.Model Bend Backend Err error }
Query describes a query definition.