Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var StandardOptimzations = []string{
"simple-caveat-pushdown",
"reachability-pruning",
}
StandardOptimzations is the default set of optimization names applied when no custom selection is required.
Functions ¶
func ApplyOptimizations ¶
func ApplyOptimizations(co query.CanonicalOutline, names []string, requestParams RequestParams) (query.CanonicalOutline, error)
ApplyOptimizations looks up each optimizer by name, sorts them by descending Priority (higher priority runs first), and applies their mutations to the outline via query.MutateOutline. Nodes that survive mutation unchanged keep their existing IDs. Newly synthesized nodes (ID==0) receive fresh IDs via query.FillMissingNodeIDs. The returned CanonicalOutline is ready to compile.
func MustRegisterOptimization ¶
func MustRegisterOptimization(opt Optimizer)
Types ¶
type Optimizer ¶
type Optimizer struct {
Name string
Description string
// NewTransform creates a whole-tree transformation for this optimizer,
// optionally using request-specific parameters. Each transform typically
// calls query.MutateOutline internally with its own mutations.
NewTransform func(RequestParams) OutlineTransform
// Priority controls the order in which optimizations are applied.
// Higher values run first.
Priority int
}
Optimizer describes a single named outline optimization.
func GetOptimization ¶
type OutlineTransform ¶
OutlineTransform is a function that transforms an entire outline tree. Each optimizer produces one of these, and they are applied sequentially.
type RequestParams ¶
RequestParams holds request-specific values available to optimizations. Static (schema-level) optimizations ignore these; request-parameterized optimizations (e.g. reachability pruning) use them to tailor their behavior.