Documentation
¶
Overview ¶
Package qry provides a way to describe and evaluate queries for local and external data.
Index ¶
- Variables
- func AutoQuery(p *exp.Prog, pp interface{}, arg lit.Val) (lit.Mut, error)
- func ReflectQuery(pp interface{}) (exp.Exp, error)
- type Backend
- type Doc
- type DomBackend
- type Field
- type Fields
- type Job
- type Kind
- type LitBackend
- type MemBackend
- func (b *MemBackend) Add(m *dom.Model, list *lit.Vals) error
- func (b *MemBackend) Close() error
- func (b *MemBackend) Exec(p *exp.Prog, j *Job) (*exp.Lit, error)
- func (b *MemBackend) Keys() (res []string)
- func (b *MemBackend) Proj() *dom.Project
- func (b *MemBackend) Stream(key string) (mig.Stream, error)
- func (b *MemBackend) Vers() *mig.Version
- type Ord
- type Provider
- type Registry
- type Sel
- type Spec
- type Subj
- type Task
Constants ¶
This section is empty.
Variables ¶
var Backends = &Registry{}
var ErrNoProvider = fmt.Errorf("no backend provider found")
var Mod *mod.Src
Mod is the xelf module source for this package that encapsulates the qry setup.
var Prov = Backends.Register(dsetProvider{}, "file")
Functions ¶
func AutoQuery ¶
AutoQuery generates query from and saves the query result into a tagged go struct value pointer.
func ReflectQuery ¶
ReflectQuery takes a tagged struct and generates and returns a query expression or an error. For now we just generate a query string which we then parse.
Types ¶
type Doc ¶
Doc is a query program environment that resolves query subjects and collects and tracks all jobs.
type DomBackend ¶
func (*DomBackend) Proj ¶
func (b *DomBackend) Proj() *dom.Project
type Field ¶
Field represents a selected field that can either map to a subject field or an expression. Expression fields can also contain sub queries.
type Job ¶
Job is the environment for a query spec and holds the task and its eventual result.
type LitBackend ¶
type LitBackend struct{}
LitBackend is a query backend that operates on literal values from the program environment.
func (LitBackend) Proj ¶
func (LitBackend) Proj() *dom.Project
type MemBackend ¶
MemBackend is a query backend that evaluates queries using in-memory literal values.
func NewDsetBackend ¶
func NewMemBackend ¶
func NewMemBackend(pr *dom.Project, v *mig.Version) *MemBackend
NewMemBackend returns a new memory backend for the given project.
func (*MemBackend) Close ¶
func (b *MemBackend) Close() error
func (*MemBackend) Keys ¶
func (b *MemBackend) Keys() (res []string)
func (*MemBackend) Proj ¶
func (b *MemBackend) Proj() *dom.Project
func (*MemBackend) Vers ¶
func (b *MemBackend) Vers() *mig.Version
type Spec ¶
Spec is the implementation to resolve calls on query subjects. It sets up the job environment, resolves arguments to form the task and calls the backend to execute the job when evaluated.