queryparser

package
v0.12.14-0...-bb29917 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	WorkspaceID       string
	TableAliases      map[string]string
	AllowedTables     []string
	SecurityFilters   []SecurityFilter // Row-level security filters (auto-injected)
	Limit             int
	MaxQueryRangeDays int32 // Maximum historical data range user can query in days
}

Config for the parser

type Parser

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

Parser rewrites ClickHouse queries

func NewParser

func NewParser(config Config) *Parser

NewParser creates a new parser

func (*Parser) ExtractColumn

func (p *Parser) ExtractColumn(columnName string) []string

ExtractColumn extracts all string literal values for a given column name from WHERE and HAVING clauses. Only extracts from positive assertions (= and IN operators), ignores negative conditions (!=, NOT IN, <, >, etc). Returns a deduplicated slice of values found for the column. Returns empty slice if no values found. Must be called after Parse().

func (*Parser) Parse

func (p *Parser) Parse(ctx context.Context, query string) (string, error)

Parse parses and rewrites a query

type SecurityFilter

type SecurityFilter struct {
	Column        string   // Column name
	AllowedValues []string // Values user is allowed to access
}

SecurityFilter represents a row-level security constraint

Jump to

Keyboard shortcuts

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