template

package
v0.32.5 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(templateStr string, filters map[string]any) (string, error)

Render processes a Jinja template string with the given filter values. It is for non-SQL values; use RenderSQL for SQL text or expressions.

func RenderSQL added in v0.24.0

func RenderSQL(source string, filters map[string]any, dialects ...string) (string, error)

RenderSQL evaluates Jinja normally (including conditions and loops), but captures every output before it can enter SQL. Outputs are substituted only inside ordinary single-quoted literals, or as numbers outside literals. Never use Render for SQL fragments containing request-controlled values.

func ValidateSQLValue added in v0.24.0

func ValidateSQLValue(value any) error

ValidateSQLValue rejects characters that cannot be interpolated portably across the SQL dialects supported by the CLI backend. That backend has no bind-parameter API; guessing a dialect's escaping rules is unsafe.

func ValidateSemanticValue added in v0.32.2

func ValidateSemanticValue(value any) error

ValidateSemanticValue allows apostrophes: the semantic compiler quotes values. Keep backslashes and controls restricted for dialects without explicit escaping.

Types

This section is empty.

Jump to

Keyboard shortcuts

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