Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrExpectedSingleStatement ¶
type ErrExpectedSingleStatement struct {
Count int
}
ErrExpectedSingleStatement indicates ParseOne received zero or multiple statements.
func (ErrExpectedSingleStatement) Error ¶
func (e ErrExpectedSingleStatement) Error() string
type ErrUnsupportedDialect ¶
type ErrUnsupportedDialect struct {
Dialect string
}
ErrUnsupportedDialect indicates there is no parser backend for the requested dialect yet.
func (ErrUnsupportedDialect) Error ¶
func (e ErrUnsupportedDialect) Error() string
type MariaDBDropForeignKeyStmt ¶
MariaDBDropForeignKeyStmt captures a MariaDB-only ALTER TABLE extension not accepted by TiDB parser.
type ParsedStatement ¶
type ParsedStatement struct {
SQL string
SourceDialect string
Kind StatementKind
Status SupportStatus
NativeNodeType string
NativeAST any
}
ParsedStatement is the project-owned parse result returned by the parser facade.
func ParseMulti ¶
func ParseMulti[D ~string](sql string, dialect D) ([]*ParsedStatement, error)
ParseMulti parses one or more SQL statements and returns project-owned parse results.
type StatementKind ¶
type StatementKind string
StatementKind identifies the recognized SQL statement family.
const ( StatementKindSelect StatementKind = "select" StatementKindInsert StatementKind = "insert" StatementKindUpdate StatementKind = "update" StatementKindDelete StatementKind = "delete" StatementKindBegin StatementKind = "begin" StatementKindCommit StatementKind = "commit" StatementKindRollback StatementKind = "rollback" StatementKindSavepoint StatementKind = "savepoint" StatementKindReleaseSavepoint StatementKind = "release_savepoint" StatementKindWith StatementKind = "with" StatementKindSetOp StatementKind = "set_op" StatementKindSet StatementKind = "set" StatementKindCreateTable StatementKind = "create_table" StatementKindCreateDatabase StatementKind = "create_database" StatementKindCreateView StatementKind = "create_view" StatementKindExplain StatementKind = "explain" StatementKindAlterTable StatementKind = "alter_table" StatementKindDropDatabase StatementKind = "drop_database" StatementKindDropTable StatementKind = "drop_table" StatementKindDropView StatementKind = "drop_view" StatementKindShow StatementKind = "show" StatementKindUse StatementKind = "use" StatementKindCreateIndex StatementKind = "create_index" StatementKindDropIndex StatementKind = "drop_index" StatementKindTruncate StatementKind = "truncate_table" StatementKindRenameTable StatementKind = "rename_table" StatementKindOtherDDL StatementKind = "other_ddl" StatementKindOtherDML StatementKind = "other_dml" StatementKindOther StatementKind = "other" )
type SupportStatus ¶
type SupportStatus string
SupportStatus records whether a parsed statement is already adapted upstream.
const ( SupportStatusSupported SupportStatus = "supported" SupportStatusRecognizedUnadapted SupportStatus = "recognized_unadapted" SupportStatusUnsupported SupportStatus = "unsupported" )
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
ast
Package ast is the abstract syntax tree parsed from a SQL statement by parser.
|
Package ast is the abstract syntax tree parsed from a SQL statement by parser. |
|
duration
Package duration provides a customized duration, which supports unit 'd', 'h' and 'm'
|
Package duration provides a customized duration, which supports unit 'd', 'h' and 'm' |
|
generate_keyword
command
|
|
|
goyacc
command
Goyacc is a version of yacc generating Go parsers.
|
Goyacc is a version of yacc generating Go parsers. |
Click to show internal directories.
Click to hide internal directories.