Documentation
¶
Overview ¶
Package parser implements a SQL parser for query validation and parameter extraction.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Column ¶
type Column struct {
Expr string
Alias string
Table string
Line int
Column int
StartOffset int
EndOffset int
}
Column represents a result column in a SELECT query.
type Diagnostic ¶
type Diagnostic struct {
Path string
Line int
Column int
EndColumn int // End column for multi-character spans
Offset int // Byte offset in file
Length int // Length of the problematic token/region
Message string
Severity Severity
}
Diagnostic represents an issue found during parsing.
type Param ¶
type Param struct {
Name string
Style ParamStyle
Order int
Line int
Column int
IsVariadic bool
VariadicCount int
StartOffset int
EndOffset int
}
Param represents a query parameter.
type ParamStyle ¶
type ParamStyle int
ParamStyle indicates how parameters are specified (positional or named).
const ( // ParamStyleUnknown indicates an unrecognized parameter style. ParamStyleUnknown ParamStyle = iota // ParamStylePositional indicates parameters using '?' or '?NNN'. ParamStylePositional // ParamStyleNamed indicates parameters using ':name'. ParamStyleNamed )
type Query ¶
type Query struct {
Block block.Block
Verb Verb
Columns []Column
Params []Param
CTEs []CTE
Diagnostics []Diagnostic
}
Query represents a parsed SQL query with metadata.
type Verb ¶
type Verb int
Verb indicates the type of SQL statement (SELECT, INSERT, etc.).
const ( // VerbUnknown indicates an unrecognized statement type. VerbUnknown Verb = iota // VerbSelect indicates a SELECT statement. VerbSelect // VerbInsert indicates an INSERT statement. VerbInsert // VerbUpdate indicates an UPDATE statement. VerbUpdate // VerbDelete indicates a DELETE statement. VerbDelete )
Click to show internal directories.
Click to hide internal directories.