Documentation
¶
Index ¶
- Constants
- func Parse(cursor *parsly.Cursor, dest interface{}) error
- func ParseCallExpr(rawExpr string) (*expr.Call, error)
- func ParseCreateIndex(SQL string) (*index.Create, error)
- func ParseCreateTable(SQL string) (*table.Create, error)
- func ParseDelete(SQL string) (*del.Statement, error)
- func ParseDropIndex(SQL string) (*index.Drop, error)
- func ParseDropTable(SQL string) (*table.Drop, error)
- func ParseInsert(SQL string) (*insert.Statement, error)
- func ParseList(raw string) (query.List, error)
- func ParseLiteral(cursor *parsly.Cursor) (*expr.Literal, error)
- func ParseQualify(cursor *parsly.Cursor, qualify *expr.Qualify) error
- func ParseQuery(SQL string, opts ...Option) (*query.Select, error)
- func ParseRegisterSet(SQL string) (*schema.RegisterSet, error)
- func ParseRegisterType(SQL string) (*schema.Register, error)
- func ParseTruncateTable(SQL string) (*table.Truncate, error)
- func ParseUpdate(SQL string) (*update.Statement, error)
- func SourceTable(value node.Node) (table string, parenthesized bool, err error)
- func Stringify(n node.Node) string
- func StripCollate(SQL string) (string, error)
- func TableIdentifierParts(source string) ([]string, error)
- func TableName(node node.Node) string
- func TableSelector(n node.Node) *expr.Selector
- func Traverse(n node.Node, visitor func(n node.Node) bool)
- func TryParseLiteral(cursor *parsly.Cursor) (*expr.Literal, error)
- type Cast
- type Column
- type ColumnLineage
- type ColumnOrigin
- type Columns
- type Kind
- func (k Kind) IsCreateTable() bool
- func (k Kind) IsDelete() bool
- func (k Kind) IsDropTable() bool
- func (k Kind) IsInsert() bool
- func (k Kind) IsLoad() bool
- func (k Kind) IsMerge() bool
- func (k Kind) IsRegisterSet() bool
- func (k Kind) IsRegisterType() bool
- func (k Kind) IsSelect() bool
- func (k Kind) IsUnknown() bool
- func (k Kind) IsUpdate() bool
- type Lineage
- type Option
- type Options
- type Stringifier
- type TableIdentifierParser
- type Token
Constants ¶
const ( KindUnknown = "unknown" KindSelect = "select" KindLoad = "load" KindInsert = "insert" KindUpdate = "update" KindMerge = "merge" KindDelete = "delete" KindRegisterType = "register type" KindRegisterSet = "register set" KindCreateTable = "create table" KindDropTable = "drop table" KindCreateIndex = "create index" KindDropIndex = "drop index" KindTruncateTable = "truncate table" )
Variables ¶
This section is empty.
Functions ¶
func ParseCallExpr ¶
ParseCallExpr parses call expression
func ParseCreateIndex ¶ added in v0.7.1
ParseCreateIndex parses create table
func ParseCreateTable ¶
ParseCreateTable parses create table
func ParseDelete ¶
ParseDelete parses DELETE statement
func ParseDropIndex ¶ added in v0.7.1
ParseDropIndex parses drop table
func ParseDropTable ¶
ParseDropTable parses drop table
func ParseInsert ¶
ParseInsert Parses INSERT INTO statement
func ParseLiteral ¶
ParseLiteral parses literal
func ParseQualify ¶
ParseQualify parses qualify expr
func ParseQuery ¶
ParseQuery parses query
func ParseRegisterSet ¶ added in v0.7.0
func ParseRegisterSet(SQL string) (*schema.RegisterSet, error)
ParseRegisterSet parses register set
func ParseRegisterType ¶ added in v0.6.0
ParseRegisterType parses register type
func ParseTruncateTable ¶ added in v0.7.1
ParseTruncateTable parses truncate table
func ParseUpdate ¶
ParseUpdate parses update statement
func SourceTable ¶ added in v0.13.0
SourceTable identifies one complete table reference and whether parentheses enclose it. Subqueries and other source expressions return an empty name. It uses the SQL table/parenthesis token owners, never keyword text heuristics, and does not mutate the supplied AST (including partially populated Raw.X).
func StripCollate ¶ added in v0.11.0
StripCollate removes COLLATE expressions from SQL while preserving structure.
func TableIdentifierParts ¶ added in v0.13.0
TableIdentifierParts parses one complete qualified table identifier into decoded name parts. It does not split dots inside delimited identifiers or accept aliases, expressions, placeholders or trailing SQL. Delimiters follow SQL doubled-quote rules (including backticks/brackets used by SQL dialects). TableName/TableSelector retain their existing AST/string behavior.
func TableSelector ¶ added in v0.8.1
TableSelector returns the table selector Node
Types ¶
type Cast ¶ added in v0.13.0
Cast describes a CAST operand and its authored type without interpreting the type as either a SQL dialect type or a host-language type.
func CastExpression ¶ added in v0.13.0
CastExpression returns nil for another function. It retains custom type spelling rather than applying NewColumn's legacy SQL type approximation. Both CAST(value AS type) and the declaration-compatible CAST(value,'type') form are accepted; consumers decide whether a call is executable or metadata.
type ColumnLineage ¶ added in v0.13.0
type ColumnLineage struct {
// contains filtered or unexported fields
}
ColumnLineage is immutable compiled projection provenance. Lookup handles proven wildcard sources without changing or walking an execution row type.
func (*ColumnLineage) Lookup ¶ added in v0.13.0
func (c *ColumnLineage) Lookup(name string) (ColumnOrigin, bool)
func (*ColumnLineage) RootTable ¶ added in v0.13.0
func (c *ColumnLineage) RootTable() string
type ColumnOrigin ¶ added in v0.13.0
type ColumnOrigin struct{ Table, Column string }
ColumnOrigin is parser-proven direct table/column provenance.
type Columns ¶ added in v0.4.0
type Columns []*Column
Columns represens column
func NewColumns ¶ added in v0.4.0
NewColumns creates a columns
func (Columns) ByLowerCase ¶ added in v0.5.1
ByLowerCase indexes column by lower cased name
func (Columns) Index ¶ added in v0.4.0
Index indexes column by first non-empty alias or name or expr respectively
func (Columns) IsStarExpr ¶ added in v0.4.0
type Kind ¶ added in v0.6.0
type Kind string
Kind represents the type of SQL statement.
func (Kind) IsCreateTable ¶ added in v0.6.0
IsCreateTable returns true if the Kind is KindCreateTable.
func (Kind) IsDropTable ¶ added in v0.6.0
IsDropTable returns true if the Kind is KindDropTable.
func (Kind) IsRegisterSet ¶ added in v0.7.0
IsRegisterSet returns true if the Kind is KindRegisterSet.
func (Kind) IsRegisterType ¶ added in v0.6.0
IsRegisterType returns true if the Kind is KindRegisterType.
type Lineage ¶ added in v0.13.0
func (Lineage) Columns ¶ added in v0.13.0
func (l Lineage) Columns() map[string]ColumnOrigin
func (Lineage) Compile ¶ added in v0.13.0
func (l Lineage) Compile() *ColumnLineage
type Option ¶ added in v0.5.1
type Option func(o *Options)
func WithErrorHandler ¶ added in v0.5.1
func WithStructuralValidation ¶ added in v0.13.0
func WithStructuralValidation() Option
WithStructuralValidation rejects unbalanced parentheses and unclosed quotes/comments before parsing. It does not promise full dialect validation.
type Stringifier ¶ added in v0.13.0
type Stringifier struct{ PreserveWindow bool }
Stringifier configures AST rendering without changing existing consumers.
type TableIdentifierParser ¶ added in v0.13.0
type TableIdentifierParser struct {
Product string
}
TableIdentifierParser configures logical table-name parsing. The zero value preserves ordinary delimited identifiers. Product "BigQuery" recognizes whole-path backticks and legacy brackets/colon separators. Parts never emits SQL.