template

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractVariableNames

func ExtractVariableNames(sql string) []string

ExtractVariableNames returns all unique variable names found in the SQL.

func ProcessOptionalClauses

func ProcessOptionalClauses(sql string, varMap map[string]Variable) string

func SubstituteVariables

func SubstituteVariables(sql string, variables []Variable) (string, error)

Types

type Variable

type Variable struct {
	Name  string       `json:"name"`
	Type  VariableType `json:"type"`
	Value interface{}  `json:"value"`
}

Variable represents a template variable with its value.

type VariableType

type VariableType string

VariableType defines the type of a template variable.

const (
	// TypeString represents a string variable that will be quoted.
	TypeString VariableType = "string"
	// TypeText is an alias for string (used by frontend).
	TypeText VariableType = "text"
	// TypeNumber represents a numeric variable inserted as-is.
	TypeNumber VariableType = "number"
	// TypeDate represents a date variable formatted as ClickHouse datetime.
	TypeDate VariableType = "date"
)

Jump to

Keyboard shortcuts

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