Documentation
¶
Overview ¶
Package query evaluates the subset of Obsidian Bases that notesd supports (docs/specs/bases.md, ADR-0037): it reads a base's YAML, checks it against the subset, folds constants, and compiles a view's filters, sort and groups to SQL over the index's files and notes tables. store.DB runs the SQL; the engine serves it as note.query.
Every property key and literal of a base reaches SQL as a bound parameter, never as SQL text; Compile writes only fixed text. The package keeps no state between calls.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct {
Location string // such as views[0].filters.and[1]; empty for the document
Expr string // the statement, when the error is in one
Msg string
}
Error is a base that notesd refuses: YAML that does not parse, a key or a statement outside the subset, or a filter that cannot be compiled exactly. The engine reports it as invalidParams.
type Options ¶
type Options struct {
View *string // the view's name; nil is the first view
Types map[string]string // property types by key lower-cased (vault.LoadTypes)
This *This // nil when there is none
ResolveLink func(from, target string) (string, error)
Now time.Time
Loc *time.Location // the zone of dates without one; nil is time.Local
Limit int // the caller's limit, 1 to 1000
}
Options are what a compile needs besides the base.
type Plan ¶
type Plan struct {
Query store.ViewQuery
View api.QueryView
Views []api.QueryView
Notice string // set when the view is outside the subset: nothing is queried
Columns []api.QueryColumn
Unshown []string
Image string // a cards view's image key as written; empty without one
// contains filtered or unexported fields
}
Plan is a compiled view: the query to run, and what the result is made of.
type This ¶
type This struct {
ID int64
Path string
Size int64
MTime time.Time
Tags []string // as the index spells them, without '#'
Links []string // each distinct link target as written, in order
}
This is the file a base is embedded in, or the base file itself: what `this` folds to (docs/specs/bases.md#this).