parse

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Diagnostic added in v0.38.0

type Diagnostic struct {
	Stage   string
	Message string
	Offset  int
	Line    int
	Column  int
}

Diagnostic describes parser issue with source position.

type FunctionCall added in v0.38.0

type FunctionCall struct {
	Name    string
	Args    []string
	Raw     string
	Offset  int
	Line    int
	Column  int
	Handled bool
}

FunctionCall captures declaration function invocation.

type FunctionHandler added in v0.38.0

type FunctionHandler interface {
	Name() string
	Handle(call *FunctionCall, result *Result) error
}

FunctionHandler handles parsed DQL function call.

type FunctionHandlerFunc added in v0.38.0

type FunctionHandlerFunc struct {
	FunctionName string
	Fn           func(call *FunctionCall, result *Result) error
}

FunctionHandlerFunc adapts function to handler.

func (FunctionHandlerFunc) Handle added in v0.38.0

func (f FunctionHandlerFunc) Handle(call *FunctionCall, result *Result) error

func (FunctionHandlerFunc) Name added in v0.38.0

func (f FunctionHandlerFunc) Name() string

type FunctionRegistry added in v0.38.0

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

FunctionRegistry stores handlers by function name.

func NewFunctionRegistry added in v0.38.0

func NewFunctionRegistry(handlers ...FunctionHandler) *FunctionRegistry

NewFunctionRegistry creates function registry.

func (*FunctionRegistry) Register added in v0.38.0

func (r *FunctionRegistry) Register(handler FunctionHandler)

Register registers function handler.

type Option

type Option func(*Options)

func WithUnknownNonReadMode

func WithUnknownNonReadMode(mode UnknownNonReadMode) Option

type Options

type Options struct {
	UnknownNonReadMode UnknownNonReadMode
}

type Parser

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

Parser parses DQL source into a shape Document.

func New

func New(opts ...Option) *Parser

New creates a DQL parser.

func (*Parser) Parse

func (p *Parser) Parse(dql string) (*shape.Document, error)

Parse parses DQL and returns parsed document with diagnostics.

type Result added in v0.38.0

type Result struct {
	Query        *query.Select
	Columns      sqlparser.Columns
	Declarations []*decl.Declaration
	TypeContext  *typectx.Context
	Functions    []*FunctionCall
	Diagnostics  []*Diagnostic
}

Result is parser output.

type UnknownNonReadMode

type UnknownNonReadMode string
const (
	UnknownNonReadModeWarn  UnknownNonReadMode = "warn"
	UnknownNonReadModeError UnknownNonReadMode = "error"
)

Jump to

Keyboard shortcuts

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