tidbparser

package
v0.320.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

README

TiDB Parser Module

TiDB-backed parser adapter for multi-statement SQL parsing and parser-warning collection.

Files

File Responsibility
parser.go Parses SQL text and preserves raw statement nodes plus parser warnings
extractor.go Wraps TiDB AST nodes in parser-neutral extractors and performs TiDB-specific statement extraction including database/schema lifecycle DDL (CREATE/DROP DATABASE/SCHEMA normalized to create_schema/drop_schema with ObjectType="database")
parser_test.go Verifies multi-statement parsing, parse-failure behavior, and extractor-backed wrapping

Exports

  • Parser
  • Result
  • ExtractedStatement
  • New()
  • WrapStatements()

Dependencies

  • Upstream: internal/application/audit, internal/domain/spec
  • Downstream: github.com/pingcap/tidb/pkg/parser

Update Rule

  • If members/interfaces/dependencies change, update this file in same change.

Documentation

Overview

Package tidbparser extracts parser-neutral statements from TiDB AST nodes. input: TiDB parser statement nodes and parser-neutral dialect metadata output: extractor-backed parsed statements for the application layer pos: infrastructure extraction adapter between TiDB AST and domain spec note: if this file changes, update this header and module README.md.

Package tidbparser loads SQL text through the TiDB parser. input: SQL text and TiDB parser runtime dependencies output: raw parsed statement nodes and parser warnings for application orchestration pos: infrastructure parser adapter for MySQL and TiDB SQL parsing note: if this file changes, update this header and module README.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlterDatabaseStatement added in v0.200.0

type AlterDatabaseStatement = *ast.AlterDatabaseStmt

type AlterPlacementPolicyStatement added in v0.200.0

type AlterPlacementPolicyStatement = *ast.AlterPlacementPolicyStmt

type AlterSequenceStatement added in v0.200.0

type AlterSequenceStatement = *ast.AlterSequenceStmt

type AlterTableStatement added in v0.15.0

type AlterTableStatement = *ast.AlterTableStmt

type AlterUserStatement added in v0.200.0

type AlterUserStatement = *ast.AlterUserStmt

type CreateIndexStatement added in v0.15.0

type CreateIndexStatement = *ast.CreateIndexStmt

type CreatePlacementPolicyStatement added in v0.200.0

type CreatePlacementPolicyStatement = *ast.CreatePlacementPolicyStmt

type CreateSequenceStatement added in v0.200.0

type CreateSequenceStatement = *ast.CreateSequenceStmt

type CreateTableStatement added in v0.15.0

type CreateTableStatement = *ast.CreateTableStmt

type CreateUserStatement added in v0.200.0

type CreateUserStatement = *ast.CreateUserStmt

type CreateViewStatement added in v0.15.0

type CreateViewStatement = *ast.CreateViewStmt

type DeleteStatement added in v0.15.0

type DeleteStatement = *ast.DeleteStmt

type DropIndexStatement added in v0.15.0

type DropIndexStatement = *ast.DropIndexStmt

type DropPlacementPolicyStatement added in v0.200.0

type DropPlacementPolicyStatement = *ast.DropPlacementPolicyStmt

type DropProcedureStatement added in v0.200.0

type DropProcedureStatement = *ast.DropProcedureStmt

type DropResourceGroupStatement added in v0.200.0

type DropResourceGroupStatement = *ast.DropResourceGroupStmt

type DropSequenceStatement added in v0.200.0

type DropSequenceStatement = *ast.DropSequenceStmt

type DropTableStatement added in v0.15.0

type DropTableStatement = *ast.DropTableStmt

type DropUserStatement added in v0.200.0

type DropUserStatement = *ast.DropUserStmt

type ExtractedStatement added in v0.15.0

type ExtractedStatement struct {
	Kind      spec.Kind
	RawSQL    string
	Extractor spec.StatementExtractor
}

ExtractedStatement is the adapter-owned parser result used by the application layer.

func WrapStatements added in v0.15.0

func WrapStatements(stmts []ast.StmtNode, warnings []string) []ExtractedStatement

type GrantStatement added in v0.200.0

type GrantStatement = *ast.GrantStmt

type InsertStatement added in v0.15.0

type InsertStatement = *ast.InsertStmt

type Parser

type Parser struct{}

Parser adapts TiDB parser behavior for DeltaScope.

func New

func New() *Parser

New returns a TiDB-backed parser adapter.

func (*Parser) Parse

func (p *Parser) Parse(ctx context.Context, sql string) (Result, error)

Parse parses SQL text into TiDB statements and preserves parser warnings.

type ProcedureInfoStatement added in v0.200.0

type ProcedureInfoStatement = *ast.ProcedureInfo

type RenameTableStatement added in v0.15.0

type RenameTableStatement = *ast.RenameTableStmt

type Result

type Result struct {
	Statements []ast.StmtNode
	Warnings   []string
}

Result is the infrastructure output of the parser adapter.

type RevokeStatement added in v0.200.0

type RevokeStatement = *ast.RevokeStmt

type StatementNode added in v0.15.0

type StatementNode = ast.StmtNode

type TruncateTableStatement added in v0.15.0

type TruncateTableStatement = *ast.TruncateTableStmt

type UpdateStatement added in v0.15.0

type UpdateStatement = *ast.UpdateStmt

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL