criteria

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package criteria validates client predicates using the SQL parser's AST and emits only approved columns, operators, and bound values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Expression string
	Type       reflect.Type
	TimeLayout string
}

type Compiler

type Compiler struct {
	Columns map[string]Column
	Methods map[string]Method
}

Compiler carries the immutable set of names allowed by view selector policy. Values map client names to trusted SQL column expressions.

func (*Compiler) Compile

func (c *Compiler) Compile(source string, placeholders []any) (string, []any, error)

func (*Compiler) CompileWithColumns

func (c *Compiler) CompileWithColumns(source string, placeholders []any) (string, []any, []Column, error)

CompileWithColumns also reports the trusted columns referenced by this invocation, including column comparisons on the right-hand side.

type Method

type Method struct {
	Name string
	Args []reflect.Type
}

func (*Method) Validate

func (m *Method) Validate() error

Validate canonicalizes an authored function name through the SQL parser. Only one function identity is accepted; argument or statement text cannot become part of the configured SQL emitted for a client method call.

Jump to

Keyboard shortcuts

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