Documentation
¶
Overview ¶
Package querytext reads the texts a person types for a query into QueryService's typed messages, and writes them back: a filter status=running, a sort -create_time, a group create_time::week, a measure cost=usage.cost_usd::sum. QueryService only reads typed messages; the command line and djinn mcp read their texts here, on the caller's side, a filter typed by the ref it reads, which the collection's schema gives.
Index ¶
- Constants
- Variables
- func Filter(ctx context.Context, s string, c queryv1.Collection, types *Types) (*queryv1.Filter, error)
- func FilterText(f *queryv1.Filter) string
- func Group(ctx context.Context, s string, c queryv1.Collection, types *Types) (*queryv1.GroupBy, error)
- func GroupText(g *queryv1.GroupBy) string
- func Measure(s string) (*queryv1.Measure, error)
- func MeasureText(m *queryv1.Measure) string
- func Order(s string) (*queryv1.Order, error)
- func OrderText(o *queryv1.Order) string
- func Time(s string) (time.Time, error)
- type Schema
- type Types
Constants ¶
const ( FilterHelp = "a filter: ref, an operator, a value, read with the type of the ref. = is equal, text ignoring case, " + "and a|b one of; != is none of, an absent value included; > >= < <= bound a number, a time (2026-11-01, in " + "this machine's time zone, or RFC 3339) or a duration (90s); *= contains, ^= begins with, ignoring case; " + "null is the absent value: status=null, status!=null, status=pending|null. An enum takes its value's name, " + "prefix or not: status=running" OrderHelp = "a sort: ref ascending, -ref descending; aggregated, a column of the table: -count" GroupHelp = "a group: ref, ref::day, ref::week, ref::month, or ref::bins(b1,b2,...) for a number or a " + "duration: answer::delay::bins(0s,1m,10m,1h)" MeasureHelp = "a measure: count, ref::fn with fn count, sum, avg, min, max, median or p90, or name=ref::fn to " + "name its column: running::median" )
The grammars of the texts, as the help of the command line says them.
Variables ¶
var ErrInvalid = errors.New("invalid query text")
ErrInvalid wraps the error of a text that does not read.
Functions ¶
func Filter ¶
func Filter(ctx context.Context, s string, c queryv1.Collection, types *Types) (*queryv1.Filter, error)
Filter reads a filter of the collection c, typed by its ref's type.
func FilterText ¶
FilterText is the text of f; a group of and, or a not of more than one filter, has none: "".
func Group ¶
func Group(ctx context.Context, s string, c queryv1.Collection, types *Types) (*queryv1.GroupBy, error)
Group reads a group of the collection c: ref, ref::day, ref::week, ref::month, or ref::bins(b1,b2,...), whose bounds read as the ref's type, a number or a duration.
func Measure ¶
Measure reads a measure: count, ref::fn, or name=ref::fn (name=count) to name its column.
Types ¶
type Schema ¶
type Schema func(ctx context.Context, c queryv1.Collection) ([]*queryv1.QueryColumn, error)
Schema gives the refs of a collection, as QueryService.Schema does.