operators

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayOperator

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

ArrayOperator handles array operations like map, filter, reduce, all, some, none, merge

func NewArrayOperator

func NewArrayOperator(config *OperatorConfig) *ArrayOperator

NewArrayOperator creates a new ArrayOperator instance with optional config

func (*ArrayOperator) ToSQL

func (a *ArrayOperator) ToSQL(operator string, args []interface{}) (string, error)

ToSQL converts an array operation to SQL

type ComparisonOperator

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

ComparisonOperator handles comparison operators (==, ===, !=, !==, >, >=, <, <=)

func NewComparisonOperator

func NewComparisonOperator(config *OperatorConfig) *ComparisonOperator

NewComparisonOperator creates a new comparison operator with optional config

func (*ComparisonOperator) ToSQL

func (c *ComparisonOperator) ToSQL(operator string, args []interface{}) (string, error)

ToSQL converts a comparison operator to SQL

type DataOperator

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

DataOperator handles data access operators (var, missing, missing_some)

func NewDataOperator

func NewDataOperator(config *OperatorConfig) *DataOperator

NewDataOperator creates a new data operator with optional config

func (*DataOperator) ToSQL

func (d *DataOperator) ToSQL(operator string, args []interface{}) (string, error)

ToSQL converts a data operator to SQL

type LogicalOperator

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

LogicalOperator handles logical operators (and, or, !, !!, if)

func NewLogicalOperator

func NewLogicalOperator(config *OperatorConfig) *LogicalOperator

NewLogicalOperator creates a new logical operator with optional config

func (*LogicalOperator) ToSQL

func (l *LogicalOperator) ToSQL(operator string, args []interface{}) (string, error)

ToSQL converts a logical operator to SQL

type NumericOperator

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

NumericOperator handles numeric operations like +, -, *, /, %, max, min

func NewNumericOperator

func NewNumericOperator(config *OperatorConfig) *NumericOperator

NewNumericOperator creates a new NumericOperator instance with optional config

func (*NumericOperator) ToSQL

func (n *NumericOperator) ToSQL(operator string, args []interface{}) (string, error)

ToSQL converts a numeric operation to SQL

type OperatorConfig added in v1.0.1

type OperatorConfig struct {
	Schema SchemaProvider
}

OperatorConfig holds shared configuration for all operators. By using a shared config object, all operators automatically see configuration changes without requiring individual SetSchema calls.

func NewOperatorConfig added in v1.0.1

func NewOperatorConfig(schema SchemaProvider) *OperatorConfig

NewOperatorConfig creates a new operator config with optional schema

func (*OperatorConfig) HasSchema added in v1.0.1

func (c *OperatorConfig) HasSchema() bool

HasSchema returns true if a schema is configured

type SchemaProvider added in v1.0.1

type SchemaProvider interface {
	// HasField checks if a field exists in the schema
	HasField(fieldName string) bool
	// GetFieldType returns the type of a field as a string, or empty string if not found
	GetFieldType(fieldName string) string
	// ValidateField checks if a field exists and returns an error if not
	ValidateField(fieldName string) error
	// IsArrayType checks if a field is of array type
	IsArrayType(fieldName string) bool
	// IsStringType checks if a field is of string type
	IsStringType(fieldName string) bool
	// IsNumericType checks if a field is of numeric type (integer or number)
	IsNumericType(fieldName string) bool
	// IsBooleanType checks if a field is of boolean type
	IsBooleanType(fieldName string) bool
	// IsEnumType checks if a field is of enum type
	IsEnumType(fieldName string) bool
	// GetAllowedValues returns the allowed values for an enum field
	GetAllowedValues(fieldName string) []string
	// ValidateEnumValue checks if a value is valid for an enum field
	ValidateEnumValue(fieldName string, value string) error
}

SchemaProvider provides schema information for field validation and type checking

type StringOperator

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

StringOperator handles string operations like cat, substr

func NewStringOperator

func NewStringOperator(config *OperatorConfig) *StringOperator

NewStringOperator creates a new StringOperator instance with optional config

func (*StringOperator) ToSQL

func (s *StringOperator) ToSQL(operator string, args []interface{}) (string, error)

ToSQL converts a string operation to SQL

Jump to

Keyboard shortcuts

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