render

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package render evaluates the template tree into (SQL, args). Under the explicit model it removes nothing implicitly: text is emitted verbatim, directives are evaluated in place, and the author anchors clauses (1=1 / trailing id) so no connector is ever left dangling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Evaluator   expr.Evaluator
	Placeholder dialect.Placeholder
	Literal     dialect.Literal
}

Config carries everything the renderer needs beyond the tree and the scope.

type Result

type Result struct {
	SQL      string
	Args     []any
	ArgSpans [][2]int
}

Result is the rendered statement: the executable placeholder form (SQL) and its bind Args. ArgSpans[i] is the [start,end) byte range in SQL of the placeholder for Args[i] (they are appended together, so the slices stay aligned); callers splice literals into those ranges to build the values-embedded review form lazily, without a second render.

func Render

func Render(n ast.Node, scope expr.Scope, cfg Config) (Result, error)

Render evaluates the tree against the scope.

Jump to

Keyboard shortcuts

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