tidbparser

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: Apache-2.0 Imports: 10 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
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 AlterTableStatement added in v0.15.0

type AlterTableStatement = *ast.AlterTableStmt

type CreateIndexStatement added in v0.15.0

type CreateIndexStatement = *ast.CreateIndexStmt

type CreateTableStatement added in v0.15.0

type CreateTableStatement = *ast.CreateTableStmt

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 DropTableStatement added in v0.15.0

type DropTableStatement = *ast.DropTableStmt

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 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(sql string) (Result, error)

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

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 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