query

package
v0.0.0-...-e6616ac Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoIndexAvb = errors.New("no index available to satisfy the WHERE query")
View Source
var ErrNoTable = errors.New("could not identify table in EXPLAIN output")

Functions

func FoldExpression

func FoldExpression(ctx context.Context, query string, db *sql.DB) (string, error)

FoldExpression returns modified query by replacing the occurrences of non-deterministic functions with deterministic values in the query.

func GetIndex

func GetIndex(where string, db *sql.DB) (string, bool, error)

GetIndex returns the index used by the query and whether it's a covering index.

func ParseSelect

func ParseSelect(query string) (*ast.SelectStmt, error)

ParseSelect parses the given SQL query as a SELECT statement and returns AST (Abstract syntax tree) node if there is no error.

func Validate

func Validate(query string, db *sql.DB) (string, error)

Validate validates the query and returns the where clause if it's valid.

Types

type FoldableFnX

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

FoldableFnX extracts foldableFns from AST node of a parsed SQL query.

func (*FoldableFnX) Enter

func (v *FoldableFnX) Enter(in ast.Node) (ast.Node, bool)

func (*FoldableFnX) Leave

func (v *FoldableFnX) Leave(in ast.Node) (ast.Node, bool)

Jump to

Keyboard shortcuts

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