Documentation
¶
Overview ¶
Package pgxcel converts checked CEL expressions into PostgreSQL WHERE fragments with positional bind placeholders.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Transpile ¶
Transpile turns ast into a Postgres WHERE fragment (no enclosing parentheses) plus the bound positional args.
ast must be checked (ast.IsChecked() == true). An unchecked AST returns an error. A nil ast returns ("", nil, nil) — the caller decides whether to omit the WHERE keyword.
Configure resolution and placeholder numbering via WithColumns and WithParamOffset.
Types ¶
type Option ¶
type Option func(*config)
Option configures a Transpile call.
func WithColumns ¶
WithColumns supplies the fail-closed AIP-path → DB-column allow-list. Any ident in the AST that is absent from columns causes an error. Dotted paths (e.g. "address.city") are looked up by their full path. When omitted, every ident in the AST errors.
func WithFunctions ¶
WithFunctions registers aliases that are normalized to canonical CEL function names before dispatch. Use this to feed in ASTs produced by parsers other than cel-go — for example einride/aip-go emits "=" / "AND" / "NOT" instead of operators.Equals / LogicalAnd / LogicalNot.
Each map entry is alias → canonical, where canonical is one of the names recognized by Transpile (typically a value from the cel-go operators package). Unknown aliases are passed through unchanged.
func WithParamOffset ¶
WithParamOffset sets the number of the first emitted placeholder. Placeholders are then numbered offset, offset+1, ... so callers can splice the fragment into a query that already has earlier bound values. Defaults to 1.