Documentation
¶
Overview ¶
Package template owns compiled SQL-template programs. It evaluates authored SQL control flow before sql/builder applies projection, criteria, relations, pagination, partitioning, and placeholder binding.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compiler ¶
type Compiler struct {
// Const is immutable trusted deployment data, never invocation input.
Const *constant.Values
Source string
InputType reflect.Type
Variables []Variable
NonWindowAliases []string
Predicate dexec.PredicateEvaluator
}
Compiler compiles one SQL source against its canonical input type.
type ConstantRenderer ¶
ConstantRenderer uses Velty's emitted-expression spans and SQLParser's quote boundaries. Template decisions, calls, locals and SQL string/comment data are not constant identifier sites. A qualified emitted reference rooted in a declared scalar constant is an identifier; ordinary scalar emission stays bound.
func (ConstantRenderer) Identifier ¶
func (r ConstantRenderer) Identifier(table string) (string, error)
Identifier renders transient table metadata through the SQL rendering owner.
func (ConstantRenderer) Validate ¶
func (r ConstantRenderer) Validate(source string) error
Validate checks identifier values and native source spans without expanding SQL.
type Evaluator ¶
type Evaluator interface {
Evaluate(context.Context, Invocation) (Result, error)
}
Evaluator is the injected SQL-template execution boundary.
type Invocation ¶
Invocation contains the canonical bound input for one template evaluation.
type Result ¶
type Result struct {
SQL string
Args []any
// ParentBindings reports that $View rendered or excluded a parent-key
// helper, so the builder must not run a second relation-binding path.
ParentBindings bool
}
Result is the expanded authored SQL handed back to the SQL builder.