parser

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomOperatorHandler added in v1.0.1

type CustomOperatorHandler interface {
	ToSQL(operator string, args []interface{}) (string, error)
}

CustomOperatorHandler is an interface for custom operator implementations. This mirrors the public OperatorHandler interface.

type CustomOperatorLookup added in v1.0.1

type CustomOperatorLookup func(operatorName string) (CustomOperatorHandler, bool)

CustomOperatorLookup is a function type for looking up custom operators.

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser parses JSON Logic expressions and converts them to SQL WHERE clauses.

func NewParser

func NewParser(config *operators.OperatorConfig) *Parser

NewParser creates a new parser instance with config. If config is nil, defaults to BigQuery dialect for backward compatibility.

func (*Parser) Parse

func (p *Parser) Parse(logic interface{}) (string, error)

Parse converts a JSON Logic expression to SQL WHERE clause.

func (*Parser) ParseCondition added in v1.0.3

func (p *Parser) ParseCondition(logic interface{}) (string, error)

ParseCondition converts a JSON Logic expression to a SQL condition without the WHERE keyword. This is useful when you need to embed the condition in a larger query.

func (*Parser) ParseConditionParameterized added in v1.0.9

func (p *Parser) ParseConditionParameterized(logic interface{}) (string, []params.QueryParam, error)

ParseConditionParameterized converts a JSON Logic expression to a SQL condition (without WHERE keyword) with bind parameter placeholders.

func (*Parser) ParseParameterized added in v1.0.9

func (p *Parser) ParseParameterized(logic interface{}) (string, []params.QueryParam, error)

ParseParameterized converts a JSON Logic expression to a SQL WHERE clause with bind parameter placeholders instead of inlined literals.

func (*Parser) SetCustomOperatorLookup added in v1.0.1

func (p *Parser) SetCustomOperatorLookup(lookup CustomOperatorLookup)

SetCustomOperatorLookup sets the function used to look up custom operators. This also sets up the validator to recognize custom operators.

func (*Parser) SetSchema added in v1.0.1

func (p *Parser) SetSchema(schema operators.SchemaProvider)

SetSchema sets the schema provider for field validation and type checking.

Jump to

Keyboard shortcuts

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