Documentation ¶
Overview ¶
Package sqlparser contains SQL parsing functionality for SQLite.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractTableIdentFromCreateTableStmt ¶
func ExtractTableIdentFromCreateTableStmt(stmt string, unescape bool) (schema, table string, err error)
ExtractTableIdentFromCreateTableStmt extracts table name (and the table's schema if specified) from a CREATE TABLE statement. If err is nil, table is guaranteed to be non-empty. If arg unescape is true, any surrounding quotation chars are trimmed from the returned values.
CREATE TABLE "sakila"."actor" ( actor_id INTEGER NOT NULL) --> sakila, actor, nil
Types ¶
type ColDef ¶ added in v0.48.2
type ColDef struct { // DefCtx is the antlr context for the column definition. DefCtx *sqlite.Column_defContext // Raw is the raw text of the entire column definition. Raw string // RawName is the raw text of the column name as it appeared in the input. // It may be double-quoted. RawName string // Name is the column name, stripped of any double-quotes. Name string // RawType is the raw text of the column type as it appeared in the input. RawType string // Type is the canonicalized column type. Type string // InputOffset is the character start index of the column definition in the // input. The def ends at InputOffset+len(Raw). InputOffset int }
ColDef represents a column definition in a CREATE TABLE statement.
func ExtractCreateTableStmtColDefs ¶ added in v0.48.2
ExtractCreateTableStmtColDefs extracts the column definitions from a CREATE TABLE statement.
Click to show internal directories.
Click to hide internal directories.