{"modulePath":"github.com/viant/sqlparser","version":"v0.13.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package sqlparser\n\n## Constants\n\n```go\nconst (\n\tKindUnknown       = \"unknown\"\n\tKindSelect        = \"select\"\n\tKindLoad          = \"load\"\n\tKindInsert        = \"insert\"\n\tKindUpdate        = \"update\"\n\tKindMerge         = \"merge\"\n\tKindDelete        = \"delete\"\n\tKindRegisterType  = \"register type\"\n\tKindRegisterSet   = \"register set\"\n\tKindCreateTable   = \"create table\"\n\tKindDropTable     = \"drop table\"\n\tKindCreateIndex   = \"create index\"\n\tKindDropIndex     = \"drop index\"\n\tKindTruncateTable = \"truncate table\"\n)\n```\n\n## Functions\n\n```go\nfunc Parse(cursor *parsly.Cursor, dest interface{}) error\n```\nParse parses SQL into supplied destination\n\n```go\nfunc ParseCallExpr(rawExpr string) (*expr.Call, error)\n```\nParseCallExpr parses call expression\n\n```go\nfunc ParseCreateIndex(SQL string) (*index.Create, error)\n```\nParseCreateIndex parses create table\n\n```go\nfunc ParseCreateTable(SQL string) (*table.Create, error)\n```\nParseCreateTable parses create table\n\n```go\nfunc ParseDelete(SQL string) (*del.Statement, error)\n```\nParseDelete parses DELETE statement\n\n```go\nfunc ParseDropIndex(SQL string) (*index.Drop, error)\n```\nParseDropIndex parses drop table\n\n```go\nfunc ParseDropTable(SQL string) (*table.Drop, error)\n```\nParseDropTable parses drop table\n\n```go\nfunc ParseInsert(SQL string) (*insert.Statement, error)\n```\nParseInsert Parses INSERT INTO statement\n\n```go\nfunc ParseList(raw string) (query.List, error)\n```\nParseList parses list\n\n```go\nfunc ParseLiteral(cursor *parsly.Cursor) (*expr.Literal, error)\n```\nParseLiteral parses literal\n\n```go\nfunc ParseQualify(cursor *parsly.Cursor, qualify *expr.Qualify) error\n```\nParseQualify parses qualify expr\n\n```go\nfunc ParseQuery(SQL string, opts ...Option) (*query.Select, error)\n```\nParseQuery parses query\n\n```go\nfunc ParseRegisterSet(SQL string) (*schema.RegisterSet, error)\n```\nParseRegisterSet parses register set\n\n```go\nfunc ParseRegisterType(SQL string) (*schema.Register, error)\n```\nParseRegisterType parses register type\n\n```go\nfunc ParseTruncateTable(SQL string) (*table.Truncate, error)\n```\nParseTruncateTable parses truncate table\n\n```go\nfunc ParseUpdate(SQL string) (*update.Statement, error)\n```\nParseUpdate parses update statement\n\n```go\nfunc SourceTable(value node.Node) (table string, parenthesized bool, err error)\n```\nSourceTable 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).\n\n```go\nfunc Stringify(n node.Node) string\n```\nStringify retains the established SQL rendering contract.\n\n```go\nfunc StripCollate(SQL string) (string, error)\n```\nStripCollate removes COLLATE expressions from SQL while preserving structure.\n\n```go\nfunc TableIdentifierParts(source string) ([]string, error)\n```\nTableIdentifierParts 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.\n\n```go\nfunc TableName(node node.Node) string\n```\nTableName returns main table name\n\n```go\nfunc TableSelector(n node.Node) *expr.Selector\n```\nTableSelector returns the table selector Node\n\n```go\nfunc Traverse(n node.Node, visitor func(n node.Node) bool)\n```\nTraverse traverse node\n\n```go\nfunc TryParseLiteral(cursor *parsly.Cursor) (*expr.Literal, error)\n```\nTryParseLiteral tries to parse literal\n\n## Types\n\n```go\ntype Cast struct {\n\tOperand string\n\tType    string\n}\n```\nCast describes a CAST operand and its authored type without interpreting the type as either a SQL dialect type or a host-language type.\n\n```go\nfunc CastExpression(call *expr.Call) (*Cast, error)\n```\nCastExpression 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.\n\n```go\ntype Column column.Spec\n```\nColumn represent column\n\n```go\nfunc NewColumn(item *query.Item) *Column\n```\n\n```go\nfunc (c *Column) Identity() string\n```\n\n```go\ntype ColumnLineage struct {\n\t// contains filtered or unexported fields\n}\n```\nColumnLineage is immutable compiled projection provenance. Lookup handles proven wildcard sources without changing or walking an execution row type.\n\n```go\nfunc (c *ColumnLineage) Lookup(name string) (ColumnOrigin, bool)\n```\n\n```go\nfunc (c *ColumnLineage) RootTable() string\n```\n\n```go\ntype ColumnOrigin struct{ Table, Column string }\n```\nColumnOrigin is parser-proven direct table/column provenance.\n\n```go\ntype Columns []*Column\n```\nColumns represens column\n\n```go\nfunc NewColumns(list query.List) Columns\n```\nNewColumns creates a columns\n\n```go\nfunc (c Columns) ByLowerCase() map[string]*Column\n```\nByLowerCase indexes column by lower cased name\n\n```go\nfunc (c Columns) ByName() map[string]*Column\n```\nByName indexes column by name\n\n```go\nfunc (c Columns) Index() map[string]*Column\n```\nIndex indexes column by first non-empty alias or name or expr respectively\n\n```go\nfunc (c Columns) IsStarExpr() bool\n```\n\n```go\nfunc (c Columns) Namespace(namespace string) Columns\n```\nNamespace returns namespace column\n\n```go\nfunc (c Columns) StarExpr(namespace string) *Column\n```\nStarExpr returns star expr\n\n```go\ntype Kind string\n```\nKind represents the type of SQL statement.\n\n```go\nfunc ParseKind(SQL string) Kind\n```\n\n```go\nfunc (k Kind) IsCreateTable() bool\n```\nIsCreateTable returns true if the Kind is KindCreateTable.\n\n```go\nfunc (k Kind) IsDelete() bool\n```\nIsDelete returns true if the Kind is KindDelete.\n\n```go\nfunc (k Kind) IsDropTable() bool\n```\nIsDropTable returns true if the Kind is KindDropTable.\n\n```go\nfunc (k Kind) IsInsert() bool\n```\nIsInsert returns true if the Kind is KindInsert.\n\n```go\nfunc (k Kind) IsLoad() bool\n```\nIsLoad returns true if the Kind is KindLoad.\n\n```go\nfunc (k Kind) IsMerge() bool\n```\nIsMerge returns true if the Kind is KindMerge.\n\n```go\nfunc (k Kind) IsRegisterSet() bool\n```\nIsRegisterSet returns true if the Kind is KindRegisterSet.\n\n```go\nfunc (k Kind) IsRegisterType() bool\n```\nIsRegisterType returns true if the Kind is KindRegisterType.\n\n```go\nfunc (k Kind) IsSelect() bool\n```\nIsSelect returns true if the Kind is KindSelect.\n\n```go\nfunc (k Kind) IsUnknown() bool\n```\nIsUnknown returns true if the Kind is KindUnknown.\n\n```go\nfunc (k Kind) IsUpdate() bool\n```\nIsUpdate returns true if the Kind is KindUpdate.\n\n```go\ntype Lineage struct{ Query *query.Select }\n```\n\n```go\nfunc (l Lineage) Columns() map[string]ColumnOrigin\n```\n\n```go\nfunc (l Lineage) Compile() *ColumnLineage\n```\n\n```go\nfunc (l Lineage) RootTable() string\n```\n\n```go\ntype Option func(o *Options)\n```\n\n```go\nfunc WithErrorHandler(fn func(err error, cur *parsly.Cursor, destNode interface{}) error) Option\n```\nWithErrorHandler extends syntax at parser-owned recovery points. For an unknown operand, destNode is \\*node.Node: a successful handler must assign a node and advance the cursor through exactly that operand. Nested argument and subquery cursors inherit the handler; unhandled errors must be returned.\n\n```go\nfunc WithStructuralValidation() Option\n```\nWithStructuralValidation rejects unbalanced parentheses/subscripts and unclosed quotes/comments before parsing. It does not promise full dialect validation.\n\n```go\ntype Options struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\ntype Stringifier struct{ PreserveWindow bool }\n```\nStringifier configures AST rendering without changing existing consumers.\n\n```go\nfunc (s Stringifier) String(n node.Node) string\n```\nString renders a node, optionally retaining authored LIMIT/OFFSET clauses.\n\n```go\ntype TableIdentifierParser struct {\n\tProduct string\n}\n```\nTableIdentifierParser 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.\n\n```go\nfunc (p TableIdentifierParser) Parts(source string) ([]string, error)\n```\n\n```go\ntype Token int\n```\nToken represents a token\n\n","path":"github.com/viant/sqlparser","name":"sqlparser","synopsis":"","isRedistributable":true}
