Documentation
¶
Overview ¶
Package queryops derives bounded, previewable DTQL operations without running a query or resolving any source. It only transforms DALgo's typed AST and returns a canonical DTQL document for the caller to inspect or submit.
Index ¶
- Constants
- Variables
- func AggregateAlias(function, column string, reserved []string) string
- type AggregateTerm
- type Preview
- func DeriveGroup(originalDTQL string, groupColumns []string, count bool, scope Scope) (Preview, error)
- func DeriveGroupAggregates(originalDTQL string, keys []string, count bool, terms []AggregateTerm, ...) (Preview, error)
- func DeriveSort(originalDTQL string, terms []SortTerm, scope Scope) (Preview, error)
- type Scope
- type SortTerm
Constants ¶
const MaxPreviewRows = 500
Variables ¶
var ( ErrUnsupported = errors.New("query derivation is unsupported") ErrInvalidColumn = errors.New("query derivation has an invalid or ambiguous column") )
Functions ¶
func AggregateAlias ¶
AggregateAlias produces a readable stable identifier, suffixing collisions case-insensitively. Explicit caller aliases are validated separately.
Types ¶
type AggregateTerm ¶
type AggregateTerm struct{ Column, Function, Alias string }
AggregateTerm names one explicit aggregate over an original projected column. COUNT(*) is represented separately by count; COUNT terms count non-null cells.
type Preview ¶
Preview is the exact validated DTQL document and its resulting projection.
func DeriveGroup ¶
func DeriveGroup(originalDTQL string, groupColumns []string, count bool, scope Scope) (Preview, error)
DeriveGroup creates a bounded query preview grouped by selected projected columns. Count adds only an explicit COUNT(*) output; no other aggregates are inferred. Empty groupColumns is refused.
func DeriveGroupAggregates ¶
func DeriveGroupAggregates(originalDTQL string, keys []string, count bool, terms []AggregateTerm, scope Scope) (Preview, error)
DeriveGroupAggregates preserves the chosen input scope and emits the exact, ordered key, optional COUNT(*), and explicit measure projection. Missing measure aliases use readable, collision-safe defaults; caller inputs stay intact.