Help us shape the future of Go! Take the 2026 Go Developer Survey

exprslots

package
v1.0.0-alpha.26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package exprslots is the one list of request string slots that carry an expr-lang expression, shared by the engine and the request-template renderer.

The engine names its compile sites through the Site* constants here (internal/exprenv re-exports them, so CompileError messages keep the same nouns) and reads the OVERLAY_FORMULA source through OverlayFormulaParam. The template package (internal/template) reads All / Match to refuse a `{{token}}` spliced into one of these slots (PULSE_TEMPLATE_EXPR_SPLICE): request params carry values into an expression, a template never splices text into it.

Leaf: stdlib only, so the template package's import ceiling (TestTemplatePackage_ImportBoundary) admits it. The coverage gates — every exprenv compile site is one of these (TestTemplateExprSplice_ CompileSitesShared, internal/exprenv), every engine expression path matches (TestTemplateExprSplice_EngineExprSlotsMatch, internal/vectors), every owner position in the request roots matches (TestTemplateExprSplice_SlotsCoverRequestRoots, here) — keep it from becoming a second hand-kept list.

Index

Constants

View Source
const (
	SiteFormula       = "formula"                  // an ATTR_FORMULA expression
	SiteFilter        = "filter"                   // a FILTER_EXPRESSION expression
	SiteTotalArgument = "formula total() argument" // one total(expr) argument
	SiteHoldout       = "regression holdout"       // a RegressionSpec.Holdout predicate
)

The compile sites: the what of an expression compile error. The runtime build and predict both name a site through these (via internal/exprenv), so their messages agree to the byte.

View Source
const (
	SlotExpression     = "expression"
	SlotHoldout        = "holdout"
	SlotOverlayFormula = "overlay_formula"
	SlotFeatureFitOn   = "feature_fit_on"
)

The slot names.

View Source
const FeatureFitOnParam = "fit_on"

FeatureFitOnParam is the feature params key carrying a row expression (FEAT_TARGET_ENCODE params.fit_on).

View Source
const OverlayFormulaParam = "formula"

OverlayFormulaParam is the OVERLAY_FORMULA params key carrying the formula source, on a Request overlay and a Compose overlay alike.

View Source
const ParamsKey = "params"

ParamsKey is the key of a params object: the request's own constants (Request.Params) or an operator's configuration. A tail directly under one is a params entry that happens to share the slot's key — `"params": {"expression": "…"}` is data, not an expression slot — and never matches.

Variables

This section is empty.

Functions

func Sites

func Sites() []string

Sites returns every compile site, in declaration order.

Types

type Slot

type Slot struct {
	// Name identifies the slot in a refusal's details.
	Name string
	// Owners are the types structs the slot lives on.
	Owners []string
	// Tail is the JSON key path the expression string sits at, array
	// indices dropped, matched as a suffix of the string's key path from
	// any request root: ["expression"] matches every filterer and
	// attribute expression wherever it nests (a Compose request, a chain
	// stage, a sweep request, a params-borne fit_on filterer list).
	Tail []string
	// Sites are the compile sites the engine reads the slot under; nil
	// for OVERLAY_FORMULA, which compiles through the overlay subset.
	Sites []string
}

Slot is one expression-bearing request string slot.

func All

func All() []Slot

All returns every expression-bearing slot, in a fixed order. The result is a copy.

func Match

func Match(keys []string) (Slot, bool)

Match reports the slot a string at JSON key path keys (array indices dropped, root first) sits in, if any.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL