sqljsonb

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSQLParser

func NewSQLParser(options ...SQLParserOption) (queryparser.Parser, error)

NewSQLParser initializes and returns a new instance of Parser.

The SQLParser is configured with a set of predefined SQL functions that can be used to construct queries, including logical operations (AND, OR), comparison operators (EQ, NOTEQ, LT, LTE, GT, GTE), and other specialized functions (IN, NOTIN, LIKE, NOTLIKE, ISNULL, ISNOTNULL, CONTAINS, OVERLAPS, etc.).

Types

type FunctionHandler

type FunctionHandler func(args ...any) (*FunctionResult, error)

func Wrap

func Wrap[T any](f func(args ...T) (*FunctionResult, error)) FunctionHandler

Wrap wraps a FunctionHandler and ensures that its arguments are of type T.

type FunctionResult

type FunctionResult struct {
	Args  []any
	Query string
}

type SQLParser

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

func (*SQLParser) Parse

func (sp *SQLParser) Parse(ctx context.Context, input any, params ...string) (string, []any, error)

Parse constructs a SQL query based on the provided input. This method tokenizes the input, verifies the structure of the tokens, and executes the corresponding SQL functions to generate the final query string along with its parameters.

type SQLParserOption

type SQLParserOption func(*SQLParser) error

func WithOverrideFunction

func WithOverrideFunction(name string, f FunctionHandler) SQLParserOption

WithOverrideFunction allows you to override an existing SQL function in the SQLParser with a custom implementation.

func WithTokenizer

func WithTokenizer(tokenizer queryparser.Tokenizer) SQLParserOption

WithTokenizer sets a custom tokenizer for the SQLParser. This allows for overriding the default tokenization behavior with a user-provided tokenizer

Jump to

Keyboard shortcuts

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