checker

package
v3.0.10+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTablesNeededExist

func GetTablesNeededExist(stmt ast.StmtNode) ([]string, error)

GetTablesNeededExist reports the table name needed to execute ast.StmtNode the specified ast.StmtNode must be a DDLNode

func GetTablesNeededNonExist

func GetTablesNeededNonExist(stmt ast.StmtNode) ([]string, error)

GetTablesNeededNonExist reports the table name that conflicts with ast.StmtNode the specified ast.StmtNode must be a DDLNode

func IsDDL

func IsDDL(stmt ast.StmtNode) bool

IsDDL reports weather the table DDLNode

Types

type DDLSyncer

type DDLSyncer struct {
	// contains filtered or unexported fields
}

DDLSyncer can sync the table structure from upstream(usually MySQL) to ExecutableChecker

func NewDDLSyncer

func NewDDLSyncer(cfg *dbutil.DBConfig, executableChecker *ExecutableChecker) (*DDLSyncer, error)

NewDDLSyncer create a new DDLSyncer

func (*DDLSyncer) Close

func (ds *DDLSyncer) Close() error

Close the DDLSyncer, if the ExecutableChecker in DDLSyncer is open, it will be closed, too

func (*DDLSyncer) SyncTable

func (ds *DDLSyncer) SyncTable(tidbContext context.Context, schemaName string, tableName string) error

SyncTable can sync table structure from upstream by table name

type ExecutableChecker

type ExecutableChecker struct {
	// contains filtered or unexported fields
}

ExecutableChecker is a part of TiDB to check the sql's executability

func NewExecutableChecker

func NewExecutableChecker() (*ExecutableChecker, error)

NewExecutableChecker creates a new ExecutableChecker

func (*ExecutableChecker) Close

func (ec *ExecutableChecker) Close() error

Close closes the ExecutableChecker

func (*ExecutableChecker) CreateTable

func (ec *ExecutableChecker) CreateTable(context context.Context, sql string) error

CreateTable creates a new table with the specified sql

func (*ExecutableChecker) DropTable

func (ec *ExecutableChecker) DropTable(context context.Context, tableName string) error

DropTable drops the the specified table

func (*ExecutableChecker) Execute

func (ec *ExecutableChecker) Execute(context context.Context, sql string) error

Execute executes the sql to check it's executability

func (*ExecutableChecker) IsTableExist

func (ec *ExecutableChecker) IsTableExist(context *context.Context, tableName string) bool

IsTableExist returns whether the table with the specified name exists

func (*ExecutableChecker) Parse

func (ec *ExecutableChecker) Parse(sql string) (stmt ast.StmtNode, err error)

Parse parses a query and returns an ast.StmtNode.

Jump to

Keyboard shortcuts

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