ast

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AggrAvg   = "AVG"
	AggrMax   = "MAX"
	AggrMin   = "MIN"
	AggrSum   = "SUM"
	AggrCount = "COUNT"
)
View Source
const (
	Distinct = "DISTINCT"
	All      = "ALL"
)

Variables

View Source
var TruePredicate = func(row proto.Row) bool { return true }

Functions

func IsHintIgnore

func IsHintIgnore(hintName string) bool

IsHintIgnore check input hint if ignored in arana

func MustRestoreToString

func MustRestoreToString(flag RestoreFlag, r Restorer) string

func RestoreToString

func RestoreToString(flag RestoreFlag, r Restorer) (string, error)

func WriteID

func WriteID(sb *strings.Builder, field string)

func WriteString

func WriteString(sb *strings.Builder, str string)

Types

type AggrFunction

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

func NewAggrFunction

func NewAggrFunction(name string, aggregator string, args []*FunctionArg) *AggrFunction

func (*AggrFunction) Accept

func (af *AggrFunction) Accept(visitor Visitor) (interface{}, error)

func (*AggrFunction) Aggregator

func (af *AggrFunction) Aggregator() (string, bool)

func (*AggrFunction) Args

func (af *AggrFunction) Args() []*FunctionArg

func (*AggrFunction) EnableCountStar

func (af *AggrFunction) EnableCountStar()

func (*AggrFunction) IsCountStar

func (af *AggrFunction) IsCountStar() bool

func (*AggrFunction) Name

func (af *AggrFunction) Name() string

func (*AggrFunction) Restore

func (af *AggrFunction) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type AggrFunctionFlag

type AggrFunctionFlag uint8

type AlgorithmType

type AlgorithmType int
const (
	AlgorithmTypeDefault AlgorithmType = iota
	AlgorithmTypeCopy
	AlgorithmTypeInplace
	AlgorithmTypeInstant
)

func (AlgorithmType) String

func (a AlgorithmType) String() string

type AlterTableSpecStatement

type AlterTableSpecStatement struct {
	Tp            AlterTableType
	OldColumnName ColumnNameExpressionAtom
	NewColumnName ColumnNameExpressionAtom
	NewColumns    []*ColumnDefine
	NewTable      TableName
	Position      *ColumnPosition
	Constraint    *Constraint
}

func (*AlterTableSpecStatement) Restore

func (a *AlterTableSpecStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type AlterTableStatement

type AlterTableStatement struct {
	Table TableName
	Specs []*AlterTableSpecStatement
}

AlterTableStatement represents mysql alter table statement. see https://dev.mysql.com/doc/refman/8.0/en/alter-table.html

func (*AlterTableStatement) Mode

func (at *AlterTableStatement) Mode() SQLType

func (*AlterTableStatement) ResetTable

func (at *AlterTableStatement) ResetTable(table string) *AlterTableStatement

func (*AlterTableStatement) Restore

func (at *AlterTableStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type AlterTableType

type AlterTableType uint8
const (
	AlterTableAddColumns AlterTableType
	AlterTableDropColumn
	AlterTableAddConstraint
	AlterTableChangeColumn
	AlterTableModifyColumn
	AlterTableRenameTable
	AlterTableRenameColumn
)

type AlwaysReturnSelfVisitor

type AlwaysReturnSelfVisitor struct{}

func (AlwaysReturnSelfVisitor) VisitAtomColumn

func (a AlwaysReturnSelfVisitor) VisitAtomColumn(node ColumnNameExpressionAtom) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitAtomConstant

func (a AlwaysReturnSelfVisitor) VisitAtomConstant(node *ConstantExpressionAtom) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitAtomFunction

func (a AlwaysReturnSelfVisitor) VisitAtomFunction(node *FunctionCallExpressionAtom) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitAtomInterval

func (a AlwaysReturnSelfVisitor) VisitAtomInterval(node *IntervalExpressionAtom) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitAtomMath

func (a AlwaysReturnSelfVisitor) VisitAtomMath(node *MathExpressionAtom) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitAtomNested

func (a AlwaysReturnSelfVisitor) VisitAtomNested(node *NestedExpressionAtom) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitAtomSystemVariable

func (a AlwaysReturnSelfVisitor) VisitAtomSystemVariable(node *SystemVariableExpressionAtom) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitAtomUnary

func (a AlwaysReturnSelfVisitor) VisitAtomUnary(node *UnaryExpressionAtom) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitAtomVariable

func (a AlwaysReturnSelfVisitor) VisitAtomVariable(node VariableExpressionAtom) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitFunction

func (a AlwaysReturnSelfVisitor) VisitFunction(node *Function) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitFunctionAggregate

func (a AlwaysReturnSelfVisitor) VisitFunctionAggregate(node *AggrFunction) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitFunctionArg

func (a AlwaysReturnSelfVisitor) VisitFunctionArg(node *FunctionArg) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitFunctionCaseWhenElse

func (a AlwaysReturnSelfVisitor) VisitFunctionCaseWhenElse(node *CaseWhenElseFunction) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitFunctionCast

func (a AlwaysReturnSelfVisitor) VisitFunctionCast(node *CastFunction) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitGroupBy

func (a AlwaysReturnSelfVisitor) VisitGroupBy(node *GroupByNode) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitGroupByItem

func (a AlwaysReturnSelfVisitor) VisitGroupByItem(node *GroupByItem) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitJoin

func (a AlwaysReturnSelfVisitor) VisitJoin(node *JoinNode) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitLimit

func (a AlwaysReturnSelfVisitor) VisitLimit(node *LimitNode) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitLogicalExpression

func (a AlwaysReturnSelfVisitor) VisitLogicalExpression(node *LogicalExpressionNode) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitNotExpression

func (a AlwaysReturnSelfVisitor) VisitNotExpression(node *NotExpressionNode) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitOrderBy

func (a AlwaysReturnSelfVisitor) VisitOrderBy(node OrderByNode) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitOrderByItem

func (a AlwaysReturnSelfVisitor) VisitOrderByItem(node *OrderByItem) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitPredicateAtom

func (a AlwaysReturnSelfVisitor) VisitPredicateAtom(node *AtomPredicateNode) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitPredicateBetween

func (a AlwaysReturnSelfVisitor) VisitPredicateBetween(node *BetweenPredicateNode) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitPredicateBinaryComparison

func (a AlwaysReturnSelfVisitor) VisitPredicateBinaryComparison(node *BinaryComparisonPredicateNode) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitPredicateExpression

func (a AlwaysReturnSelfVisitor) VisitPredicateExpression(node *PredicateExpressionNode) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitPredicateIn

func (a AlwaysReturnSelfVisitor) VisitPredicateIn(node *InPredicateNode) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitPredicateLike

func (a AlwaysReturnSelfVisitor) VisitPredicateLike(node *LikePredicateNode) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitPredicateRegexp

func (a AlwaysReturnSelfVisitor) VisitPredicateRegexp(node *RegexpPredicationNode) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitSelectElementColumn

func (a AlwaysReturnSelfVisitor) VisitSelectElementColumn(node *SelectElementColumn) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitSelectElementExpr

func (a AlwaysReturnSelfVisitor) VisitSelectElementExpr(node *SelectElementExpr) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitSelectElementFunction

func (a AlwaysReturnSelfVisitor) VisitSelectElementFunction(node *SelectElementFunction) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitSelectElementWildcard

func (a AlwaysReturnSelfVisitor) VisitSelectElementWildcard(node *SelectElementAll) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitSelectStatement

func (a AlwaysReturnSelfVisitor) VisitSelectStatement(node *SelectStatement) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitTableName

func (a AlwaysReturnSelfVisitor) VisitTableName(node TableName) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitTableSource

func (a AlwaysReturnSelfVisitor) VisitTableSource(node *TableSourceNode) (interface{}, error)

func (AlwaysReturnSelfVisitor) VisitUnionStatement

func (a AlwaysReturnSelfVisitor) VisitUnionStatement(node *UnionSelectStatement) (interface{}, error)

type AnalyzeTableStatement

type AnalyzeTableStatement struct {
	Tables []*TableName
}

func NewAnalyzeTableStatement

func NewAnalyzeTableStatement() *AnalyzeTableStatement

func (*AnalyzeTableStatement) Mode

func (a *AnalyzeTableStatement) Mode() SQLType

func (*AnalyzeTableStatement) Restore

func (a *AnalyzeTableStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type AtomPredicateNode

type AtomPredicateNode struct {
	A ExpressionAtom
}

func (*AtomPredicateNode) Accept

func (a *AtomPredicateNode) Accept(visitor Visitor) (interface{}, error)

func (*AtomPredicateNode) Clone

func (a *AtomPredicateNode) Clone() PredicateNode

func (*AtomPredicateNode) Column

func (*AtomPredicateNode) Restore

func (a *AtomPredicateNode) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type BaseInsertStatement

type BaseInsertStatement interface {
	Statement
	IsSetSyntax() bool
	IsIgnore() bool
	Priority() (string, bool)
}

type BaseShow

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

func (*BaseShow) Filter

func (bs *BaseShow) Filter() func(proto.Row) bool

func (*BaseShow) Like

func (bs *BaseShow) Like() (string, bool)

func (*BaseShow) Restore

func (bs *BaseShow) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

func (*BaseShow) Where

func (bs *BaseShow) Where() (ExpressionNode, bool)

type BaseShowWithSingleColumn

type BaseShowWithSingleColumn struct {
	*BaseShow
	// contains filtered or unexported fields
}

BaseShowWithSingleColumn for `show databases` and `show tables` clause which only have one column. Get result and do filter locally

func (*BaseShowWithSingleColumn) Filter

func (bs *BaseShowWithSingleColumn) Filter() func(proto.Row) bool

func (*BaseShowWithSingleColumn) Like

func (bs *BaseShowWithSingleColumn) Like() (string, bool)

type BaseVisitor

type BaseVisitor struct{}

func (BaseVisitor) VisitAtomColumn

func (b BaseVisitor) VisitAtomColumn(node ColumnNameExpressionAtom) (interface{}, error)

func (BaseVisitor) VisitAtomConstant

func (b BaseVisitor) VisitAtomConstant(node *ConstantExpressionAtom) (interface{}, error)

func (BaseVisitor) VisitAtomFunction

func (b BaseVisitor) VisitAtomFunction(node *FunctionCallExpressionAtom) (interface{}, error)

func (BaseVisitor) VisitAtomInterval

func (b BaseVisitor) VisitAtomInterval(node *IntervalExpressionAtom) (interface{}, error)

func (BaseVisitor) VisitAtomMath

func (b BaseVisitor) VisitAtomMath(node *MathExpressionAtom) (interface{}, error)

func (BaseVisitor) VisitAtomNested

func (b BaseVisitor) VisitAtomNested(node *NestedExpressionAtom) (interface{}, error)

func (BaseVisitor) VisitAtomSystemVariable

func (b BaseVisitor) VisitAtomSystemVariable(node *SystemVariableExpressionAtom) (interface{}, error)

func (BaseVisitor) VisitAtomUnary

func (b BaseVisitor) VisitAtomUnary(node *UnaryExpressionAtom) (interface{}, error)

func (BaseVisitor) VisitAtomVariable

func (b BaseVisitor) VisitAtomVariable(node VariableExpressionAtom) (interface{}, error)

func (BaseVisitor) VisitFunction

func (b BaseVisitor) VisitFunction(node *Function) (interface{}, error)

func (BaseVisitor) VisitFunctionAggregate

func (b BaseVisitor) VisitFunctionAggregate(node *AggrFunction) (interface{}, error)

func (BaseVisitor) VisitFunctionArg

func (b BaseVisitor) VisitFunctionArg(node *FunctionArg) (interface{}, error)

func (BaseVisitor) VisitFunctionCaseWhenElse

func (b BaseVisitor) VisitFunctionCaseWhenElse(node *CaseWhenElseFunction) (interface{}, error)

func (BaseVisitor) VisitFunctionCast

func (b BaseVisitor) VisitFunctionCast(node *CastFunction) (interface{}, error)

func (BaseVisitor) VisitGroupBy

func (b BaseVisitor) VisitGroupBy(node *GroupByNode) (interface{}, error)

func (BaseVisitor) VisitGroupByItem

func (b BaseVisitor) VisitGroupByItem(node *GroupByItem) (interface{}, error)

func (BaseVisitor) VisitJoin

func (b BaseVisitor) VisitJoin(node *JoinNode) (interface{}, error)

func (BaseVisitor) VisitLimit

func (b BaseVisitor) VisitLimit(node *LimitNode) (interface{}, error)

func (BaseVisitor) VisitLogicalExpression

func (b BaseVisitor) VisitLogicalExpression(node *LogicalExpressionNode) (interface{}, error)

func (BaseVisitor) VisitNotExpression

func (b BaseVisitor) VisitNotExpression(node *NotExpressionNode) (interface{}, error)

func (BaseVisitor) VisitOrderBy

func (b BaseVisitor) VisitOrderBy(node OrderByNode) (interface{}, error)

func (BaseVisitor) VisitOrderByItem

func (b BaseVisitor) VisitOrderByItem(node *OrderByItem) (interface{}, error)

func (BaseVisitor) VisitPredicateAtom

func (b BaseVisitor) VisitPredicateAtom(node *AtomPredicateNode) (interface{}, error)

func (BaseVisitor) VisitPredicateBetween

func (b BaseVisitor) VisitPredicateBetween(node *BetweenPredicateNode) (interface{}, error)

func (BaseVisitor) VisitPredicateBinaryComparison

func (b BaseVisitor) VisitPredicateBinaryComparison(node *BinaryComparisonPredicateNode) (interface{}, error)

func (BaseVisitor) VisitPredicateExpression

func (b BaseVisitor) VisitPredicateExpression(node *PredicateExpressionNode) (interface{}, error)

func (BaseVisitor) VisitPredicateIn

func (b BaseVisitor) VisitPredicateIn(node *InPredicateNode) (interface{}, error)

func (BaseVisitor) VisitPredicateLike

func (b BaseVisitor) VisitPredicateLike(node *LikePredicateNode) (interface{}, error)

func (BaseVisitor) VisitPredicateRegexp

func (b BaseVisitor) VisitPredicateRegexp(node *RegexpPredicationNode) (interface{}, error)

func (BaseVisitor) VisitSelectElementColumn

func (b BaseVisitor) VisitSelectElementColumn(node *SelectElementColumn) (interface{}, error)

func (BaseVisitor) VisitSelectElementExpr

func (b BaseVisitor) VisitSelectElementExpr(node *SelectElementExpr) (interface{}, error)

func (BaseVisitor) VisitSelectElementFunction

func (b BaseVisitor) VisitSelectElementFunction(node *SelectElementFunction) (interface{}, error)

func (BaseVisitor) VisitSelectElementWildcard

func (b BaseVisitor) VisitSelectElementWildcard(node *SelectElementAll) (interface{}, error)

func (BaseVisitor) VisitSelectStatement

func (b BaseVisitor) VisitSelectStatement(node *SelectStatement) (interface{}, error)

func (BaseVisitor) VisitTableName

func (b BaseVisitor) VisitTableName(node TableName) (interface{}, error)

func (BaseVisitor) VisitTableSource

func (b BaseVisitor) VisitTableSource(node *TableSourceNode) (interface{}, error)

func (BaseVisitor) VisitUnionStatement

func (b BaseVisitor) VisitUnionStatement(node *UnionSelectStatement) (interface{}, error)

type BetweenPredicateNode

type BetweenPredicateNode struct {
	Not   bool
	Key   PredicateNode
	Left  PredicateNode
	Right PredicateNode
}

func (*BetweenPredicateNode) Accept

func (b *BetweenPredicateNode) Accept(visitor Visitor) (interface{}, error)

func (*BetweenPredicateNode) Clone

func (*BetweenPredicateNode) Restore

func (b *BetweenPredicateNode) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type BinaryComparisonPredicateNode

type BinaryComparisonPredicateNode struct {
	Left  PredicateNode
	Right PredicateNode
	Op    cmp.Comparison
}

func (*BinaryComparisonPredicateNode) Accept

func (b *BinaryComparisonPredicateNode) Accept(visitor Visitor) (interface{}, error)

func (*BinaryComparisonPredicateNode) Clone

func (*BinaryComparisonPredicateNode) Restore

func (b *BinaryComparisonPredicateNode) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type CaseWhenBranch

type CaseWhenBranch struct {
	When *FunctionArg
	Then *FunctionArg
}

type CaseWhenElseFunction

type CaseWhenElseFunction struct {
	CaseBlock    ExpressionNode
	BranchBlocks []*CaseWhenBranch
	ElseBlock    *FunctionArg
}

func (*CaseWhenElseFunction) Accept

func (c *CaseWhenElseFunction) Accept(visitor Visitor) (interface{}, error)

func (*CaseWhenElseFunction) Restore

func (c *CaseWhenElseFunction) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type CastFunction

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

func (*CastFunction) Accept

func (c *CastFunction) Accept(visitor Visitor) (interface{}, error)

func (*CastFunction) GetCast

func (c *CastFunction) GetCast() (*ConvertDataType, bool)

func (*CastFunction) GetCharset

func (c *CastFunction) GetCharset() (string, bool)

func (*CastFunction) Restore

func (c *CastFunction) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

func (*CastFunction) SetSource

func (c *CastFunction) SetSource(src ExpressionNode)

func (*CastFunction) Source

func (c *CastFunction) Source() ExpressionNode

type CastType

type CastType uint8
const (
	CastToBinary CastType
	CastToNChar
	CastToChar
	CastToDate
	CastToDateTime
	CastToTime
	CastToJson
	CastToDecimal
	CastToSigned
	CastToUnsigned
	CastToSignedInteger
	CastToUnsignedInteger
)

func (CastType) String

func (c CastType) String() string

type CheckTableStmt

type CheckTableStmt struct {
	Tables []*TableName
}

func NewCheckTableStmt

func NewCheckTableStmt() *CheckTableStmt

func (*CheckTableStmt) CntParams

func (c *CheckTableStmt) CntParams() int

func (*CheckTableStmt) Mode

func (c *CheckTableStmt) Mode() SQLType

func (*CheckTableStmt) Restore

func (c *CheckTableStmt) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ColumnDefine

type ColumnDefine struct {
	Column  ColumnNameExpressionAtom
	Tp      string
	Options []*ColumnOption
}

func (*ColumnDefine) Restore

func (c *ColumnDefine) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ColumnNameExpressionAtom

type ColumnNameExpressionAtom []string

func NewSingleColumnNameExpressionAtom

func NewSingleColumnNameExpressionAtom(name string) ColumnNameExpressionAtom

func (ColumnNameExpressionAtom) Accept

func (c ColumnNameExpressionAtom) Accept(visitor Visitor) (interface{}, error)

func (ColumnNameExpressionAtom) Clone

func (ColumnNameExpressionAtom) Prefix

func (c ColumnNameExpressionAtom) Prefix() string

func (ColumnNameExpressionAtom) Restore

func (c ColumnNameExpressionAtom) Restore(flag RestoreFlag, sb *strings.Builder, _ *[]int) error

func (ColumnNameExpressionAtom) String

func (c ColumnNameExpressionAtom) String() string

func (ColumnNameExpressionAtom) Suffix

func (c ColumnNameExpressionAtom) Suffix() string

type ColumnOption

type ColumnOption struct {
	Tp     ColumnOptionType
	Expr   ExpressionNode
	StrVal string
}

func (*ColumnOption) Restore

func (c *ColumnOption) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ColumnOptionType

type ColumnOptionType uint8
const (
	ColumnOptionPrimaryKey ColumnOptionType
	ColumnOptionNotNull
	ColumnOptionAutoIncrement
	ColumnOptionDefaultValue
	ColumnOptionUniqKey
	ColumnOptionNull
	ColumnOptionComment
	ColumnOptionCollate
	ColumnOptionColumnFormat
	ColumnOptionStorage
)

type ColumnPosition

type ColumnPosition struct {
	Tp     ColumnPositionType
	Column ColumnNameExpressionAtom
}

func (*ColumnPosition) Restore

func (c *ColumnPosition) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ColumnPositionType

type ColumnPositionType uint8
const (
	ColumnPositionFirst ColumnPositionType
	ColumnPositionAfter
)

type ConstantExpressionAtom

type ConstantExpressionAtom struct {
	Inner interface{}
}

func (*ConstantExpressionAtom) Accept

func (c *ConstantExpressionAtom) Accept(visitor Visitor) (interface{}, error)

func (*ConstantExpressionAtom) Clone

func (*ConstantExpressionAtom) IsNull

func (c *ConstantExpressionAtom) IsNull() bool

func (*ConstantExpressionAtom) Restore

func (c *ConstantExpressionAtom) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

func (*ConstantExpressionAtom) String

func (c *ConstantExpressionAtom) String() string

func (*ConstantExpressionAtom) Value

func (c *ConstantExpressionAtom) Value() interface{}

type Constraint

type Constraint struct {
	Tp   ConstraintType
	Name string
	Keys []*IndexPartSpec
}

func (*Constraint) Restore

func (c *Constraint) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ConstraintType

type ConstraintType uint8
const (
	ConstraintNoConstraint ConstraintType = iota
	ConstraintPrimaryKey
	ConstraintKey
	ConstraintIndex
	ConstraintUniq
	ConstraintUniqKey
	ConstraintUniqIndex
	ConstraintFulltext
)

type ConvertDataType

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

func (*ConvertDataType) Charset

func (cd *ConvertDataType) Charset() (string, bool)

func (*ConvertDataType) Dimensions

func (cd *ConvertDataType) Dimensions() (int64, int64)

func (*ConvertDataType) Parse

func (cd *ConvertDataType) Parse(s string) error

func (*ConvertDataType) String

func (cd *ConvertDataType) String() string

func (*ConvertDataType) Type

func (cd *ConvertDataType) Type() CastType

type CreateIndexStatement

type CreateIndexStatement struct {
	IndexName   string
	Table       TableName
	KeyType     IndexKeyType
	Keys        []*IndexPartSpec
	IndexOption *IndexOption
	LockAlg     *IndexLockAndAlgorithm
}

func (*CreateIndexStatement) Mode

func (c *CreateIndexStatement) Mode() SQLType

func (*CreateIndexStatement) Restore

func (c *CreateIndexStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type CreateTableStmt

type CreateTableStmt struct {
	IfNotExists bool
	// TemporaryKeyword
	// Meanless when TemporaryKeyword is not TemporaryGlobal.
	// ON COMMIT DELETE ROWS => true
	// ON COMMIT PRESERVE ROW => false
	// OnCommitDelete bool
	Table       *TableName
	ReferTable  *TableName
	Cols        []*ast.ColumnDef
	Constraints []*ast.Constraint
	Options     []*ast.TableOption
}

func NewCreateTableStmt

func NewCreateTableStmt() *CreateTableStmt

func (*CreateTableStmt) Mode

func (c *CreateTableStmt) Mode() SQLType

func (*CreateTableStmt) Restore

func (c *CreateTableStmt) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type DeleteStatement

type DeleteStatement struct {
	Table   TableName
	Hint    *HintNode
	Where   ExpressionNode
	OrderBy OrderByNode
	Limit   *LimitNode
	// contains filtered or unexported fields
}

DeleteStatement represents mysql delete statement. see https://dev.mysql.com/doc/refman/8.0/en/delete.html

func (*DeleteStatement) IsIgnore

func (ds *DeleteStatement) IsIgnore() bool

func (*DeleteStatement) IsLowPriority

func (ds *DeleteStatement) IsLowPriority() bool

func (*DeleteStatement) IsQuick

func (ds *DeleteStatement) IsQuick() bool

func (*DeleteStatement) Mode

func (ds *DeleteStatement) Mode() SQLType

func (*DeleteStatement) Restore

func (ds *DeleteStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

Restore implements Restorer.

type DescribeStatement

type DescribeStatement struct {
	Table  TableName
	Column string
}

DescribeStatement represents mysql describe statement. see https://dev.mysql.com/doc/refman/8.0/en/describe.html

func (*DescribeStatement) Mode

func (d *DescribeStatement) Mode() SQLType

func (*DescribeStatement) Restore

func (d *DescribeStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

Restore implements Restorer.

type DropIndexStatement

type DropIndexStatement struct {
	IfExists  bool
	IndexName string
	Table     TableName
}

func (*DropIndexStatement) Mode

func (d *DropIndexStatement) Mode() SQLType

func (*DropIndexStatement) Restore

func (d *DropIndexStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type DropTableStatement

type DropTableStatement struct {
	Tables []*TableName
}

func NewDropTableStatement

func NewDropTableStatement() *DropTableStatement

func (DropTableStatement) Mode

func (d DropTableStatement) Mode() SQLType

func (DropTableStatement) Restore

func (d DropTableStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type DropTriggerStatement

type DropTriggerStatement struct {
	IfExists bool
	Table    TableName
}

func (DropTriggerStatement) Mode

func (d DropTriggerStatement) Mode() SQLType

func (DropTriggerStatement) Restore

func (d DropTriggerStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ExplainStatement

type ExplainStatement struct {
	Target Statement
	Table  TableName
}

ExplainStatement represents mysql explain statement. see https://dev.mysql.com/doc/refman/8.0/en/explain.html

func (*ExplainStatement) Mode

func (e *ExplainStatement) Mode() SQLType

func (*ExplainStatement) Restore

func (e *ExplainStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ExpressionAtom

type ExpressionAtom interface {
	Node
	Restorer

	Clone() ExpressionAtom
	// contains filtered or unexported methods
}

type ExpressionMode

type ExpressionMode uint8
const (
	EmLogical ExpressionMode
	EmPredicate
	EmNot
)

type ExpressionNode

type ExpressionNode interface {
	Node
	Restorer
	Mode() ExpressionMode
	Clone() ExpressionNode
}

type FromDatabase

type FromDatabase string

func (FromDatabase) String

func (f FromDatabase) String() string

type FromNode

type FromNode = []*TableSourceNode

type FromTable

type FromTable string

func (FromTable) String

func (f FromTable) String() string

type Function

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

func (*Function) Accept

func (f *Function) Accept(visitor Visitor) (interface{}, error)

func (*Function) Args

func (f *Function) Args() []*FunctionArg

func (*Function) Name

func (f *Function) Name() string

func (*Function) Restore

func (f *Function) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

func (*Function) Type

func (f *Function) Type() FunctionType

type FunctionArg

type FunctionArg struct {
	Type  FunctionArgType
	Value interface{}
}

func (*FunctionArg) Accept

func (f *FunctionArg) Accept(visitor Visitor) (interface{}, error)

func (*FunctionArg) Restore

func (f *FunctionArg) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type FunctionArgType

type FunctionArgType uint8
const (
	FunctionArgConstant FunctionArgType
	FunctionArgColumn
	FunctionArgExpression
	FunctionArgFunction
	FunctionArgAggrFunction
	FunctionArgCaseWhenElseFunction
	FunctionArgCastFunction
)

type FunctionCallExpressionAtom

type FunctionCallExpressionAtom struct {
	F Node // *Function OR *AggrFunction OR *CaseWhenElseFunction OR *CastFunction
}

func (*FunctionCallExpressionAtom) Accept

func (f *FunctionCallExpressionAtom) Accept(visitor Visitor) (interface{}, error)

func (*FunctionCallExpressionAtom) Clone

func (*FunctionCallExpressionAtom) Restore

func (f *FunctionCallExpressionAtom) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type FunctionType

type FunctionType uint8
const (
	Fudf FunctionType
	Fscalar
	Fspec
	Fpasswd
)

func (FunctionType) String

func (f FunctionType) String() string

type GroupByItem

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

func (*GroupByItem) Expr

func (gb *GroupByItem) Expr() ExpressionNode

func (*GroupByItem) HasOrder

func (gb *GroupByItem) HasOrder() bool

func (*GroupByItem) IsOrderDesc

func (gb *GroupByItem) IsOrderDesc() bool

func (*GroupByItem) Restore

func (gb *GroupByItem) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type GroupByNode

type GroupByNode struct {
	RollUp bool
	Items  []*GroupByItem
}

type HintItem

type HintItem struct {
	TP       HintType
	HintExpr string
}

type HintNode

type HintNode struct {
	Items []HintItem
}

func (*HintNode) Restore

func (h *HintNode) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

1. Only restore mysql optimizer hints by default 2. Other domain hints can be supported by flag

type HintType

type HintType = uint8
const (
	AranaSelfHint HintType
	MysqlHint
)

type InPredicateNode

type InPredicateNode struct {
	Not bool
	P   PredicateNode
	E   []ExpressionNode
}

func (*InPredicateNode) Accept

func (ip *InPredicateNode) Accept(visitor Visitor) (interface{}, error)

func (*InPredicateNode) Clone

func (ip *InPredicateNode) Clone() PredicateNode

func (*InPredicateNode) Restore

func (ip *InPredicateNode) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type IndexHint

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

func (*IndexHint) Action

func (ih *IndexHint) Action() string

func (*IndexHint) IndexHintType

func (ih *IndexHint) IndexHintType() (string, bool)

func (*IndexHint) Indexes

func (ih *IndexHint) Indexes() []string

func (*IndexHint) KeyFormat

func (ih *IndexHint) KeyFormat() string

func (*IndexHint) Restore

func (ih *IndexHint) Restore(flag RestoreFlag, sb *strings.Builder, _ *[]int) error

type IndexKeyType

type IndexKeyType int

IndexKeyType is the type for index key.

const (
	IndexKeyTypeUnique IndexKeyType
	IndexKeyTypeSpatial
	IndexKeyTypeFullText
)

Index key types.

type IndexLockAndAlgorithm

type IndexLockAndAlgorithm struct {
	LockTp      LockType
	AlgorithmTp AlgorithmType
}

func (*IndexLockAndAlgorithm) Restore

func (i *IndexLockAndAlgorithm) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type IndexOption

type IndexOption struct {
	KeyBlockSize uint64
	Tp           IndexType
	Comment      string
	ParserName   string
}

IndexOption is the index options.

  KEY_BLOCK_SIZE [=] value
| index_type
| WITH PARSER parser_name
| COMMENT 'string'

See https://dev.mysql.com/doc/refman/5.7/en/create-index.html

func (*IndexOption) Restore

func (i *IndexOption) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type IndexPartSpec

type IndexPartSpec struct {
	Column ColumnNameExpressionAtom
	Expr   ExpressionNode
}

func (*IndexPartSpec) Restore

func (i *IndexPartSpec) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type IndexType

type IndexType int

IndexType is the type of index. e.g. using {btree | hash}

const (
	IndexTypeInvalid IndexType = iota
	IndexTypeBtree
	IndexTypeHash
)

func (IndexType) String

func (i IndexType) String() string

type InsertSelectStatement

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

func (InsertSelectStatement) Flag

func (b InsertSelectStatement) Flag() uint8

func (InsertSelectStatement) IsDelayed

func (b InsertSelectStatement) IsDelayed() bool

func (InsertSelectStatement) IsHighPriority

func (b InsertSelectStatement) IsHighPriority() bool

func (InsertSelectStatement) IsIgnore

func (b InsertSelectStatement) IsIgnore() bool

func (InsertSelectStatement) IsLowPriority

func (b InsertSelectStatement) IsLowPriority() bool

func (InsertSelectStatement) IsSetSyntax

func (b InsertSelectStatement) IsSetSyntax() bool

func (*InsertSelectStatement) Mode

func (is *InsertSelectStatement) Mode() SQLType

func (InsertSelectStatement) Priority

func (b InsertSelectStatement) Priority() (priority string, ok bool)

func (*InsertSelectStatement) Restore

func (is *InsertSelectStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

func (*InsertSelectStatement) Select

func (is *InsertSelectStatement) Select() *SelectStatement

func (InsertSelectStatement) SetFlag

func (b InsertSelectStatement) SetFlag(flag uint8)

type InsertStatement

type InsertStatement struct {
	DuplicatedUpdates []*UpdateElement
	Values            [][]ExpressionNode
	// contains filtered or unexported fields
}

InsertStatement represents mysql insert statement. see https://dev.mysql.com/doc/refman/8.0/en/insert.html

func NewInsertStatement

func NewInsertStatement(table TableName, columns []string) *InsertStatement

func (InsertStatement) Flag

func (b InsertStatement) Flag() uint8

func (InsertStatement) IsDelayed

func (b InsertStatement) IsDelayed() bool

func (InsertStatement) IsHighPriority

func (b InsertStatement) IsHighPriority() bool

func (InsertStatement) IsIgnore

func (b InsertStatement) IsIgnore() bool

func (InsertStatement) IsLowPriority

func (b InsertStatement) IsLowPriority() bool

func (InsertStatement) IsSetSyntax

func (b InsertStatement) IsSetSyntax() bool

func (*InsertStatement) Mode

func (is *InsertStatement) Mode() SQLType

func (InsertStatement) Priority

func (b InsertStatement) Priority() (priority string, ok bool)

func (*InsertStatement) Restore

func (is *InsertStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

func (InsertStatement) SetFlag

func (b InsertStatement) SetFlag(flag uint8)

type IntervalExpressionAtom

type IntervalExpressionAtom struct {
	Unit  ast.TimeUnitType
	Value PredicateNode
}

func (*IntervalExpressionAtom) Accept

func (ie *IntervalExpressionAtom) Accept(visitor Visitor) (interface{}, error)

func (*IntervalExpressionAtom) Clone

func (*IntervalExpressionAtom) Duration

func (ie *IntervalExpressionAtom) Duration() time.Duration

func (*IntervalExpressionAtom) Restore

func (ie *IntervalExpressionAtom) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type JoinNode

type JoinNode struct {
	Target  *TableSourceItem
	On      ExpressionNode
	Typ     JoinType
	Natural bool
}

func (*JoinNode) Accept

func (jn *JoinNode) Accept(visitor Visitor) (interface{}, error)

func (*JoinNode) Restore

func (jn *JoinNode) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type JoinType

type JoinType uint8
const (
	LeftJoin JoinType
	RightJoin
	InnerJoin
)

func (JoinType) String

func (j JoinType) String() string

type KillStmt

type KillStmt struct {
	Query        bool
	ConnectionID uint64
}

func (*KillStmt) Mode

func (k *KillStmt) Mode() SQLType

func (*KillStmt) Restore

func (k *KillStmt) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type LikePredicateNode

type LikePredicateNode struct {
	Not   bool
	Left  PredicateNode
	Right PredicateNode
}

func (*LikePredicateNode) Accept

func (l *LikePredicateNode) Accept(visitor Visitor) (interface{}, error)

func (*LikePredicateNode) Clone

func (l *LikePredicateNode) Clone() PredicateNode

func (*LikePredicateNode) Restore

func (l *LikePredicateNode) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type LimitNode

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

func (*LimitNode) HasOffset

func (ln *LimitNode) HasOffset() bool

func (*LimitNode) IsLimitVar

func (ln *LimitNode) IsLimitVar() bool

func (*LimitNode) IsOffsetVar

func (ln *LimitNode) IsOffsetVar() bool

func (*LimitNode) Limit

func (ln *LimitNode) Limit() int64

func (*LimitNode) Offset

func (ln *LimitNode) Offset() int64

func (*LimitNode) Restore

func (ln *LimitNode) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

func (*LimitNode) SetHasOffset

func (ln *LimitNode) SetHasOffset()

func (*LimitNode) SetLimit

func (ln *LimitNode) SetLimit(n int64)

func (*LimitNode) SetLimitVar

func (ln *LimitNode) SetLimitVar()

func (*LimitNode) SetOffset

func (ln *LimitNode) SetOffset(n int64)

func (*LimitNode) SetOffsetVar

func (ln *LimitNode) SetOffsetVar()

func (*LimitNode) UnsetHasOffset

func (ln *LimitNode) UnsetHasOffset()

func (*LimitNode) UnsetLimitVar

func (ln *LimitNode) UnsetLimitVar()

func (*LimitNode) UnsetOffsetVar

func (ln *LimitNode) UnsetOffsetVar()

type LockType

type LockType int
const (
	LockTypeNone LockType = iota + 1
	LockTypeDefault
	LockTypeShared
	LockTypeExclusive
)

func (LockType) String

func (l LockType) String() string

type LogicalExpressionNode

type LogicalExpressionNode struct {
	Or    bool
	Left  ExpressionNode
	Right ExpressionNode
}

func (*LogicalExpressionNode) Accept

func (l *LogicalExpressionNode) Accept(visitor Visitor) (interface{}, error)

func (*LogicalExpressionNode) Clone

func (*LogicalExpressionNode) Mode

func (*LogicalExpressionNode) Restore

func (l *LogicalExpressionNode) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type MathExpressionAtom

type MathExpressionAtom struct {
	Left     ExpressionAtom
	Operator string
	Right    ExpressionAtom
}

func (*MathExpressionAtom) Accept

func (m *MathExpressionAtom) Accept(visitor Visitor) (interface{}, error)

func (*MathExpressionAtom) Clone

func (*MathExpressionAtom) Restore

func (m *MathExpressionAtom) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type NestedExpressionAtom

type NestedExpressionAtom struct {
	First ExpressionNode
}

func (*NestedExpressionAtom) Accept

func (n *NestedExpressionAtom) Accept(visitor Visitor) (interface{}, error)

func (*NestedExpressionAtom) Clone

func (*NestedExpressionAtom) Restore

func (n *NestedExpressionAtom) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type Node

type Node interface {
	// Accept accepts a visitor.
	Accept(visitor Visitor) (interface{}, error)
}

Node represents a ast node.

type NotExpressionNode

type NotExpressionNode struct {
	E ExpressionNode
}

func (*NotExpressionNode) Accept

func (n *NotExpressionNode) Accept(visitor Visitor) (interface{}, error)

func (*NotExpressionNode) Clone

func (n *NotExpressionNode) Clone() ExpressionNode

func (*NotExpressionNode) Mode

func (*NotExpressionNode) Restore

func (n *NotExpressionNode) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type OptimizeTableStatement

type OptimizeTableStatement struct {
	Tables []*TableName
}

func NewOptimizeTableStatement

func NewOptimizeTableStatement() *OptimizeTableStatement

func (*OptimizeTableStatement) Mode

func (a *OptimizeTableStatement) Mode() SQLType

func (*OptimizeTableStatement) Restore

func (a *OptimizeTableStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type OrderByItem

type OrderByItem struct {
	Expr ExpressionAtom
	Desc bool
}

func (OrderByItem) Restore

func (o OrderByItem) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type OrderByNode

type OrderByNode []*OrderByItem

func (OrderByNode) Restore

func (o OrderByNode) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

func (OrderByNode) String

func (o OrderByNode) String() string

type ParseOption

type ParseOption func(*parseOption)

func WithCharset

func WithCharset(charset string) ParseOption

WithCharset sets the charset.

func WithCollation

func WithCollation(collation string) ParseOption

WithCollation sets the collation.

type PredicateExpressionNode

type PredicateExpressionNode struct {
	P PredicateNode
}

func (*PredicateExpressionNode) Accept

func (a *PredicateExpressionNode) Accept(visitor Visitor) (interface{}, error)

func (*PredicateExpressionNode) Clone

func (*PredicateExpressionNode) Mode

func (*PredicateExpressionNode) Restore

func (a *PredicateExpressionNode) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type PredicateNode

type PredicateNode interface {
	Node
	Restorer

	Clone() PredicateNode
	// contains filtered or unexported methods
}

type RegexpPredicationNode

type RegexpPredicationNode struct {
	Left  PredicateNode
	Right PredicateNode
	Not   bool
}

func (*RegexpPredicationNode) Accept

func (rp *RegexpPredicationNode) Accept(visitor Visitor) (interface{}, error)

func (*RegexpPredicationNode) Clone

func (*RegexpPredicationNode) Restore

func (rp *RegexpPredicationNode) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type RenameTableStatement

type RenameTableStatement struct {
	TableToTables []*TableToTable
}

RenameTableStatement represents mysql RENAME statement. see https://dev.mysql.com/doc/refman/8.0/en/rename-table.html

func NewRenameTableStmt

func NewRenameTableStmt() *RenameTableStatement

func (*RenameTableStatement) CntParams

func (r *RenameTableStatement) CntParams() int

func (*RenameTableStatement) Mode

func (r *RenameTableStatement) Mode() SQLType

func (*RenameTableStatement) Restore

func (r *RenameTableStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type RepairTableStmt

type RepairTableStmt struct {
	Tables []*TableName
}

func NewRepairTableStmt

func NewRepairTableStmt() *RepairTableStmt

func (*RepairTableStmt) CntParams

func (r *RepairTableStmt) CntParams() int

func (*RepairTableStmt) Mode

func (r *RepairTableStmt) Mode() SQLType

func (*RepairTableStmt) Restore

func (r *RepairTableStmt) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ReplaceSelectStatement

type ReplaceSelectStatement struct {
	Select *SelectStatement
	// contains filtered or unexported fields
}

func (ReplaceSelectStatement) Flag

func (b ReplaceSelectStatement) Flag() uint8

func (ReplaceSelectStatement) IsDelayed

func (b ReplaceSelectStatement) IsDelayed() bool

func (ReplaceSelectStatement) IsHighPriority

func (b ReplaceSelectStatement) IsHighPriority() bool

func (ReplaceSelectStatement) IsIgnore

func (b ReplaceSelectStatement) IsIgnore() bool

func (ReplaceSelectStatement) IsLowPriority

func (b ReplaceSelectStatement) IsLowPriority() bool

func (ReplaceSelectStatement) IsSetSyntax

func (b ReplaceSelectStatement) IsSetSyntax() bool

func (*ReplaceSelectStatement) Mode

func (r *ReplaceSelectStatement) Mode() SQLType

func (ReplaceSelectStatement) Priority

func (b ReplaceSelectStatement) Priority() (priority string, ok bool)

func (*ReplaceSelectStatement) Restore

func (r *ReplaceSelectStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

func (ReplaceSelectStatement) SetFlag

func (b ReplaceSelectStatement) SetFlag(flag uint8)

type ReplaceStatement

type ReplaceStatement struct {
	Values [][]ExpressionNode
	// contains filtered or unexported fields
}

func (ReplaceStatement) Flag

func (b ReplaceStatement) Flag() uint8

func (ReplaceStatement) IsDelayed

func (b ReplaceStatement) IsDelayed() bool

func (ReplaceStatement) IsHighPriority

func (b ReplaceStatement) IsHighPriority() bool

func (ReplaceStatement) IsIgnore

func (b ReplaceStatement) IsIgnore() bool

func (ReplaceStatement) IsLowPriority

func (b ReplaceStatement) IsLowPriority() bool

func (ReplaceStatement) IsSetSyntax

func (b ReplaceStatement) IsSetSyntax() bool

func (*ReplaceStatement) Mode

func (r *ReplaceStatement) Mode() SQLType

func (ReplaceStatement) Priority

func (b ReplaceStatement) Priority() (priority string, ok bool)

func (*ReplaceStatement) Restore

func (r *ReplaceStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

func (ReplaceStatement) SetFlag

func (b ReplaceStatement) SetFlag(flag uint8)

type RestoreFlag

type RestoreFlag uint32
const (
	RestoreDefault RestoreFlag = 0

	RestoreLowerKeyword RestoreFlag = 1 << iota // force use lower-case keyword
	RestoreWithoutAlias
	RestoreCompat80
)

func (RestoreFlag) Has

func (rf RestoreFlag) Has(flag RestoreFlag) bool

type Restorer

type Restorer interface {
	Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error
}

type SQLType

type SQLType uint8

SQLType represents the type of SQL.

const (
	SQLTypeSelect             SQLType // SELECT
	SQLTypeDelete                     // DELETE
	SQLTypeUpdate                     // UPDATE
	SQLTypeInsert                     // INSERT
	SQLTypeInsertSelect               // INSERT SELECT
	SQLTypeReplace                    // REPLACE
	SQLTypeTruncate                   // TRUNCATE
	SQLTypeDropTable                  // DROP TABLE
	SQLTypeAlterTable                 // ALTER TABLE
	SQLTypeDropIndex                  // DROP INDEX
	SQLTypeShowDatabases              // SHOW DATABASES
	SQLTypeShowCollation              // SHOW COLLATION
	SQLTypeShowTables                 // SHOW TABLES
	SQLTypeShowOpenTables             // SHOW OPEN TABLES
	SQLTypeShowIndex                  // SHOW INDEX
	SQLTypeShowColumns                // SHOW COLUMNS
	SQLTypeShowCreate                 // SHOW CREATE
	SQLTypeShowVariables              // SHOW VARIABLES
	SQLTypeShowNodes                  // SHOW NODES
	SQLTypeShowTopology               // SHOW TOPOLOGY
	SQLTypeShowUsers                  // SHOW USERS
	SQLTypeShowShardingTable          // SHOW SHARDING TABLE
	SQLTypeShowCreateSequence         // SHOW CREATE SEQUENCE
	SQLTypeDescribe                   // DESCRIBE
	SQLTypeExplain                    // EXPLAIN
	SQLTypeUnion                      // UNION
	SQLTypeDropTrigger                // DROP TRIGGER
	SQLTypeCreateIndex                // CREATE INDEX
	SQLTypeShowStatus                 // SHOW STATUS
	SQLTypeShowTableStatus            // SHOW TABLE STATUS
	SQLTypeShowWarnings               // SHOW WARNINGS
	SQLTypeShowCharacterSet           // SHOW CHARACTER SET
	SQLTypeSetVariable                // SET VARIABLE
	SQLTypeAnalyzeTable               // ANALYZE TABLE
	SQLTypeOptimizeTable              // OPTIMIZE TABLE
	SQLTypeShowMasterStatus           // SHOW MASTER STATUS
	SQLTypeShowReplicas               // SHOW REPLICAS
	SQLTypeShowProcessList            // SHOW PROCESSLIST
	SQLTypeShowReplicaStatus          // SHOW REPLICA STATUS
	SQLTypeKill                       // KILL
	SQLTypeCheckTable                 // CHECK TABLE
	SQLTypeRenameTable                // RENAME TABLE
	SQLTypeRepairTable                // REPAIR TABLE
	SQLTypeCreateTable                // CREATE TABLE
	SQLTypeShowDatabaseRules          // SHOW DATABASE RULES
	SQLTypeShowTableRules             // SHOW TABLE RULES
)

func (SQLType) String

func (s SQLType) String() string

type SelectElement

type SelectElement interface {
	Node
	Restorer

	// Alias returns the alias if available.
	Alias() string

	// ToSelectString converts current SelectElement to SQL SELECT string and return it.
	ToSelectString() string

	// DisplayName returns the actual display name of field.
	DisplayName() string
	// contains filtered or unexported methods
}

SelectElement represents a select element.

type SelectElementAll

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

func (*SelectElementAll) Accept

func (s *SelectElementAll) Accept(visitor Visitor) (interface{}, error)

func (*SelectElementAll) Alias

func (s *SelectElementAll) Alias() string

func (*SelectElementAll) DisplayName

func (s *SelectElementAll) DisplayName() string

func (*SelectElementAll) Prefix

func (s *SelectElementAll) Prefix() string

func (*SelectElementAll) Restore

func (s *SelectElementAll) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

func (*SelectElementAll) ToSelectString

func (s *SelectElementAll) ToSelectString() string

type SelectElementColumn

type SelectElementColumn struct {
	Name []string
	// contains filtered or unexported fields
}

func NewSelectElementColumn

func NewSelectElementColumn(name []string, alias string) *SelectElementColumn

func (*SelectElementColumn) Accept

func (s *SelectElementColumn) Accept(visitor Visitor) (interface{}, error)

func (*SelectElementColumn) Alias

func (s *SelectElementColumn) Alias() string

func (*SelectElementColumn) DisplayName

func (s *SelectElementColumn) DisplayName() string

func (*SelectElementColumn) Prefix

func (s *SelectElementColumn) Prefix() string

func (*SelectElementColumn) Restore

func (s *SelectElementColumn) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

func (*SelectElementColumn) Suffix

func (s *SelectElementColumn) Suffix() string

func (*SelectElementColumn) ToSelectString

func (s *SelectElementColumn) ToSelectString() string

type SelectElementExpr

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

func NewSelectElementExpr

func NewSelectElementExpr(expr ExpressionNode, alias string) *SelectElementExpr

func NewSelectElementExprFull

func NewSelectElementExprFull(expr ExpressionNode, alias string, originalText string) *SelectElementExpr

func (*SelectElementExpr) Accept

func (s *SelectElementExpr) Accept(visitor Visitor) (interface{}, error)

func (*SelectElementExpr) Alias

func (s *SelectElementExpr) Alias() string

func (*SelectElementExpr) DisplayName

func (s *SelectElementExpr) DisplayName() string

func (*SelectElementExpr) Expression

func (s *SelectElementExpr) Expression() ExpressionNode

func (*SelectElementExpr) Restore

func (s *SelectElementExpr) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

func (*SelectElementExpr) ToSelectString

func (s *SelectElementExpr) ToSelectString() string

type SelectElementFunction

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

func NewSelectElementAggrFunction

func NewSelectElementAggrFunction(fun *AggrFunction, alias string) *SelectElementFunction

func NewSelectElementCaseWhenFunction

func NewSelectElementCaseWhenFunction(fun *CaseWhenElseFunction, alias string) *SelectElementFunction

func NewSelectElementCastFunction

func NewSelectElementCastFunction(fun *CastFunction, alias string) *SelectElementFunction

func NewSelectElementFunction

func NewSelectElementFunction(fun *Function, alias string) *SelectElementFunction

func (*SelectElementFunction) Accept

func (s *SelectElementFunction) Accept(visitor Visitor) (interface{}, error)

func (*SelectElementFunction) Alias

func (s *SelectElementFunction) Alias() string

func (*SelectElementFunction) DisplayName

func (s *SelectElementFunction) DisplayName() string

func (*SelectElementFunction) Function

func (s *SelectElementFunction) Function() Node

func (*SelectElementFunction) Restore

func (s *SelectElementFunction) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

func (*SelectElementFunction) SetAggrFunction

func (s *SelectElementFunction) SetAggrFunction(fn *AggrFunction)

func (*SelectElementFunction) SetAlias

func (s *SelectElementFunction) SetAlias(alias string)

func (*SelectElementFunction) SetCaseWhenElseFunction

func (s *SelectElementFunction) SetCaseWhenElseFunction(fn *CaseWhenElseFunction)

func (*SelectElementFunction) SetCastFunction

func (s *SelectElementFunction) SetCastFunction(fn *CastFunction)

func (*SelectElementFunction) SetFunction

func (s *SelectElementFunction) SetFunction(fn *Function)

func (*SelectElementFunction) ToSelectString

func (s *SelectElementFunction) ToSelectString() string

type SelectLock

type SelectLock uint8
const (
	SelectLockForUpdate SelectLock
	SelectLockInShardMode
)

func (SelectLock) String

func (sl SelectLock) String() string

type SelectNode

type SelectNode = []SelectElement

type SelectStatement

type SelectStatement struct {
	Select   SelectNode
	From     FromNode
	Where    ExpressionNode
	GroupBy  *GroupByNode
	Having   ExpressionNode
	OrderBy  OrderByNode
	Limit    *LimitNode
	Lock     SelectLock
	Distinct bool
	Hint     *HintNode
}

func ParseSelect

func ParseSelect(sql string, options ...ParseOption) ([]*hint.Hint, *SelectStatement, error)

ParseSelect parses the SQL string to SelectStatement.

func (*SelectStatement) Accept

func (ss *SelectStatement) Accept(visitor Visitor) (interface{}, error)

func (*SelectStatement) HasJoin

func (ss *SelectStatement) HasJoin() bool

func (*SelectStatement) HasSubQuery

func (ss *SelectStatement) HasSubQuery() bool

func (*SelectStatement) Mode

func (ss *SelectStatement) Mode() SQLType

func (*SelectStatement) Restore

func (ss *SelectStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type SetStatement

type SetStatement struct {
	Variables []*VariablePair
}

func (SetStatement) Mode

func (d SetStatement) Mode() SQLType

func (SetStatement) Restore

func (d SetStatement) Restore(rf RestoreFlag, sb *strings.Builder, args *[]int) error

type ShowCharset

type ShowCharset struct {
	*BaseShow
}

func (*ShowCharset) Mode

func (s *ShowCharset) Mode() SQLType

func (*ShowCharset) Restore

func (s *ShowCharset) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ShowCollation

type ShowCollation struct {
	*BaseShow
}

func (ShowCollation) Mode

func (s ShowCollation) Mode() SQLType

func (ShowCollation) Restore

func (s ShowCollation) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ShowColumns

type ShowColumns struct {
	TableName TableName

	Column string
	// contains filtered or unexported fields
}

func (*ShowColumns) ColumnsFormat

func (sh *ShowColumns) ColumnsFormat() string

func (*ShowColumns) Extended

func (sh *ShowColumns) Extended() bool

func (*ShowColumns) Full

func (sh *ShowColumns) Full() bool

func (*ShowColumns) IsExtended

func (sh *ShowColumns) IsExtended() bool

func (*ShowColumns) IsFull

func (sh *ShowColumns) IsFull() bool

func (*ShowColumns) Like

func (sh *ShowColumns) Like() (string, bool)

func (*ShowColumns) Mode

func (sh *ShowColumns) Mode() SQLType

func (*ShowColumns) Restore

func (sh *ShowColumns) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

func (*ShowColumns) Table

func (sh *ShowColumns) Table() TableName

func (*ShowColumns) TableFormat

func (sh *ShowColumns) TableFormat() string

type ShowCreate

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

func (*ShowCreate) Mode

func (s *ShowCreate) Mode() SQLType

func (*ShowCreate) ResetTable

func (s *ShowCreate) ResetTable(table string) *ShowCreate

func (*ShowCreate) Restore

func (s *ShowCreate) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

func (*ShowCreate) Target

func (s *ShowCreate) Target() string

func (*ShowCreate) Type

func (s *ShowCreate) Type() ShowCreateType

type ShowCreateSequence

type ShowCreateSequence struct {
	Tenant string
}

func (*ShowCreateSequence) Mode

func (s *ShowCreateSequence) Mode() SQLType

func (*ShowCreateSequence) Restore

func (s *ShowCreateSequence) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ShowCreateType

type ShowCreateType uint8
const (
	ShowCreateTypeTable ShowCreateType
	ShowCreateTypeEvent
	ShowCreateTypeFunc
	ShowCreateTypeProc
	ShowCreateTypeTrigger
	ShowCreateTypeView
)

func (ShowCreateType) String

func (s ShowCreateType) String() string

type ShowDatabaseRule

type ShowDatabaseRule struct {
	*BaseShow
	Database  string
	TableName string
}

func (*ShowDatabaseRule) Mode

func (s *ShowDatabaseRule) Mode() SQLType

func (*ShowDatabaseRule) Restore

func (s *ShowDatabaseRule) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ShowDatabases

type ShowDatabases struct {
	*BaseShowWithSingleColumn
}

func (ShowDatabases) Mode

func (s ShowDatabases) Mode() SQLType

func (ShowDatabases) Restore

func (s ShowDatabases) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ShowIndex

type ShowIndex struct {
	TableName TableName
	// contains filtered or unexported fields
}

func (*ShowIndex) Mode

func (s *ShowIndex) Mode() SQLType

func (*ShowIndex) Restore

func (s *ShowIndex) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

func (*ShowIndex) Where

func (s *ShowIndex) Where() (ExpressionNode, bool)

type ShowMasterStatus

type ShowMasterStatus struct {
	*BaseShow
}

func (*ShowMasterStatus) Mode

func (s *ShowMasterStatus) Mode() SQLType

func (*ShowMasterStatus) Restore

func (s *ShowMasterStatus) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ShowNodes

type ShowNodes struct {
	Tenant string
}

func (*ShowNodes) Mode

func (s *ShowNodes) Mode() SQLType

func (*ShowNodes) Restore

func (s *ShowNodes) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ShowOpenTables

type ShowOpenTables struct {
	*BaseShow
}

func (ShowOpenTables) Mode

func (s ShowOpenTables) Mode() SQLType

func (ShowOpenTables) Restore

func (s ShowOpenTables) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ShowProcessList

type ShowProcessList struct {
	*BaseShow
}

func (*ShowProcessList) Mode

func (s *ShowProcessList) Mode() SQLType

func (*ShowProcessList) Restore

func (s *ShowProcessList) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ShowReplicaStatus

type ShowReplicaStatus struct {
	*BaseShow
}

func (*ShowReplicaStatus) Mode

func (s *ShowReplicaStatus) Mode() SQLType

func (*ShowReplicaStatus) Restore

func (s *ShowReplicaStatus) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ShowReplicas

type ShowReplicas struct {
	*BaseShow
}

func (ShowReplicas) Mode

func (s ShowReplicas) Mode() SQLType

func (ShowReplicas) Restore

func (s ShowReplicas) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ShowShardingTable

type ShowShardingTable struct {
	*BaseShow
}

func (*ShowShardingTable) Mode

func (s *ShowShardingTable) Mode() SQLType

func (*ShowShardingTable) Restore

func (s *ShowShardingTable) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ShowStatus

type ShowStatus struct {
	*BaseShow
	// contains filtered or unexported fields
}

func (*ShowStatus) Mode

func (s *ShowStatus) Mode() SQLType

func (*ShowStatus) Restore

func (s *ShowStatus) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ShowTableRule

type ShowTableRule struct {
	*BaseShow
	Database  string
	TableName string
}

func (*ShowTableRule) Mode

func (s *ShowTableRule) Mode() SQLType

func (*ShowTableRule) Restore

func (s *ShowTableRule) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ShowTableStatus

type ShowTableStatus struct {
	*BaseShow
	Database string
}

func (*ShowTableStatus) Mode

func (s *ShowTableStatus) Mode() SQLType

func (*ShowTableStatus) Restore

func (s *ShowTableStatus) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ShowTables

type ShowTables struct {
	*BaseShowWithSingleColumn
}

func (*ShowTables) Mode

func (st *ShowTables) Mode() SQLType

func (*ShowTables) Restore

func (st *ShowTables) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ShowTopology

type ShowTopology struct {
	*BaseShow
}

func (ShowTopology) Mode

func (s ShowTopology) Mode() SQLType

func (ShowTopology) Restore

func (s ShowTopology) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ShowUsers

type ShowUsers struct {
	Tenant string
}

func (*ShowUsers) Mode

func (s *ShowUsers) Mode() SQLType

func (*ShowUsers) Restore

func (s *ShowUsers) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ShowVariables

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

func (*ShowVariables) Like

func (s *ShowVariables) Like() (string, bool)

func (*ShowVariables) Mode

func (s *ShowVariables) Mode() SQLType

func (*ShowVariables) Restore

func (s *ShowVariables) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type ShowWarnings

type ShowWarnings struct {
	*BaseShow
	Limit *LimitNode
}

func (*ShowWarnings) Mode

func (s *ShowWarnings) Mode() SQLType

func (*ShowWarnings) Restore

func (s *ShowWarnings) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

func (*ShowWarnings) Validate

func (s *ShowWarnings) Validate() error

type Statement

type Statement interface {
	Restorer
	// Mode returns the SQLType of current Statement.
	Mode() SQLType
}

Statement represents the SQL statement.

func FromStmtNode

func FromStmtNode(node ast.StmtNode) (Statement, error)

FromStmtNode converts raw ast node to Statement.

func MustParse

func MustParse(sql string) ([]*hint.Hint, Statement)

MustParse parses the SQL string to Statement, panic if failed.

func Parse

func Parse(sql string, options ...ParseOption) ([]*hint.Hint, Statement, error)

Parse parses the SQL string to Statement.

type SystemVariableExpressionAtom

type SystemVariableExpressionAtom struct {
	Name   string
	System bool
	Global bool
}

func (*SystemVariableExpressionAtom) Accept

func (sy *SystemVariableExpressionAtom) Accept(visitor Visitor) (interface{}, error)

func (*SystemVariableExpressionAtom) Clone

func (*SystemVariableExpressionAtom) IsCompat80

func (sy *SystemVariableExpressionAtom) IsCompat80() bool

func (*SystemVariableExpressionAtom) Restore

func (sy *SystemVariableExpressionAtom) Restore(rf RestoreFlag, sb *strings.Builder, _ *[]int) error

type TableName

type TableName []string

func (TableName) Accept

func (t TableName) Accept(visitor Visitor) (interface{}, error)

func (TableName) Prefix

func (t TableName) Prefix() (prefix string)

func (TableName) ResetSuffix

func (t TableName) ResetSuffix(suffix string) TableName

func (TableName) Restore

func (t TableName) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

func (TableName) String

func (t TableName) String() string

func (TableName) Suffix

func (t TableName) Suffix() string

type TableSourceItem

type TableSourceItem struct {
	Source     Node // TableName,*SelectStatement,*UnionSelectStatement
	Alias      string
	Partitions []string
	IndexHints []*IndexHint
}

func (*TableSourceItem) ResetTableName

func (t *TableSourceItem) ResetTableName(newTableName string) bool

func (*TableSourceItem) Restore

func (t *TableSourceItem) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type TableSourceNode

type TableSourceNode struct {
	TableSourceItem
	Joins []*JoinNode
}

func (*TableSourceNode) Accept

func (t *TableSourceNode) Accept(visitor Visitor) (interface{}, error)

func (*TableSourceNode) Restore

func (t *TableSourceNode) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type TableToTable

type TableToTable struct {
	OldTable *TableName
	NewTable *TableName
}

TableToTable represents renaming old table to new table used in RenameTableStmt.

func (TableToTable) Restore

func (t TableToTable) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type TruncateStatement

type TruncateStatement struct {
	Table TableName
}

TruncateStatement represents mysql describe statement. see https://dev.mysql.com/doc/refman/8.0/en/truncate-table.html

func (*TruncateStatement) Mode

func (stmt *TruncateStatement) Mode() SQLType

func (*TruncateStatement) ResetTable

func (stmt *TruncateStatement) ResetTable(table string) *TruncateStatement

func (*TruncateStatement) Restore

func (stmt *TruncateStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

Restore implements Restorer.

type UnaryExpressionAtom

type UnaryExpressionAtom struct {
	Operator string
	Inner    Node // ExpressionAtom or *BinaryComparisonPredicateNode
}

func (*UnaryExpressionAtom) Accept

func (u *UnaryExpressionAtom) Accept(visitor Visitor) (interface{}, error)

func (*UnaryExpressionAtom) Clone

func (*UnaryExpressionAtom) IsOperatorNot

func (u *UnaryExpressionAtom) IsOperatorNot() bool

func (*UnaryExpressionAtom) Restore

func (u *UnaryExpressionAtom) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type UnionSelectStatement

type UnionSelectStatement struct {
	First               *SelectStatement
	UnionStatementItems []*UnionStatementItem
	OrderBy             OrderByNode
}

func (*UnionSelectStatement) Accept

func (u *UnionSelectStatement) Accept(visitor Visitor) (interface{}, error)

func (*UnionSelectStatement) Mode

func (u *UnionSelectStatement) Mode() SQLType

func (*UnionSelectStatement) Restore

func (u *UnionSelectStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type UnionStatementItem

type UnionStatementItem struct {
	Type UnionType
	Stmt *SelectStatement
}

type UnionType

type UnionType uint8
const (
	UnionTypeAll UnionType
	UnionTypeDistinct
)

func (UnionType) String

func (u UnionType) String() string

type UpdateElement

type UpdateElement struct {
	Column ColumnNameExpressionAtom
	Value  ExpressionNode
}

func (*UpdateElement) Restore

func (u *UpdateElement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type UpdateStatement

type UpdateStatement struct {
	Table      TableName
	Hint       *HintNode
	TableAlias string
	Updated    []*UpdateElement
	Where      ExpressionNode
	OrderBy    OrderByNode
	Limit      *LimitNode
	// contains filtered or unexported fields
}

UpdateStatement represents mysql update statement. see https://dev.mysql.com/doc/refman/8.0/en/update.html

func (*UpdateStatement) IsEnableLowPriority

func (u *UpdateStatement) IsEnableLowPriority() bool

func (*UpdateStatement) IsIgnore

func (u *UpdateStatement) IsIgnore() bool

func (*UpdateStatement) Mode

func (u *UpdateStatement) Mode() SQLType

func (*UpdateStatement) ResetTable

func (u *UpdateStatement) ResetTable(table string) *UpdateStatement

func (*UpdateStatement) Restore

func (u *UpdateStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type VariableExpressionAtom

type VariableExpressionAtom int

func (VariableExpressionAtom) Accept

func (v VariableExpressionAtom) Accept(visitor Visitor) (interface{}, error)

func (VariableExpressionAtom) Clone

func (VariableExpressionAtom) N

func (VariableExpressionAtom) Restore

func (v VariableExpressionAtom) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error

type VariablePair

type VariablePair struct {
	Name   string
	Value  ExpressionAtom
	Global bool // @@GLOBAL.xxx
	System bool // @@:true, @:false
}

type Visitor

type Visitor interface {
	// VisitSelectStatement visits select statement.
	VisitSelectStatement(node *SelectStatement) (interface{}, error)
	// VisitUnionStatement visits union select statement.
	VisitUnionStatement(node *UnionSelectStatement) (interface{}, error)
	// VisitSelectElementWildcard visits select element of wildcard.
	VisitSelectElementWildcard(node *SelectElementAll) (interface{}, error)
	// VisitJoin visits join node.
	VisitJoin(node *JoinNode) (interface{}, error)

	VisitSelectElementColumn(node *SelectElementColumn) (interface{}, error)
	VisitSelectElementFunction(node *SelectElementFunction) (interface{}, error)
	VisitSelectElementExpr(node *SelectElementExpr) (interface{}, error)
	VisitTableSource(node *TableSourceNode) (interface{}, error)
	VisitTableName(node TableName) (interface{}, error)
	VisitLimit(node *LimitNode) (interface{}, error)
	VisitGroupBy(node *GroupByNode) (interface{}, error)
	VisitGroupByItem(node *GroupByItem) (interface{}, error)
	VisitOrderBy(node OrderByNode) (interface{}, error)
	VisitOrderByItem(node *OrderByItem) (interface{}, error)
	VisitLogicalExpression(node *LogicalExpressionNode) (interface{}, error)
	VisitNotExpression(node *NotExpressionNode) (interface{}, error)
	VisitPredicateExpression(node *PredicateExpressionNode) (interface{}, error)
	VisitPredicateAtom(node *AtomPredicateNode) (interface{}, error)
	VisitPredicateBetween(node *BetweenPredicateNode) (interface{}, error)
	VisitPredicateBinaryComparison(node *BinaryComparisonPredicateNode) (interface{}, error)
	VisitPredicateIn(node *InPredicateNode) (interface{}, error)
	VisitPredicateLike(node *LikePredicateNode) (interface{}, error)
	VisitPredicateRegexp(node *RegexpPredicationNode) (interface{}, error)
	VisitAtomColumn(node ColumnNameExpressionAtom) (interface{}, error)
	VisitAtomConstant(node *ConstantExpressionAtom) (interface{}, error)
	VisitAtomFunction(node *FunctionCallExpressionAtom) (interface{}, error)
	VisitAtomNested(node *NestedExpressionAtom) (interface{}, error)
	VisitAtomUnary(node *UnaryExpressionAtom) (interface{}, error)
	VisitAtomMath(node *MathExpressionAtom) (interface{}, error)
	VisitAtomSystemVariable(node *SystemVariableExpressionAtom) (interface{}, error)
	VisitAtomVariable(node VariableExpressionAtom) (interface{}, error)
	VisitAtomInterval(node *IntervalExpressionAtom) (interface{}, error)
	VisitFunction(node *Function) (interface{}, error)
	VisitFunctionAggregate(node *AggrFunction) (interface{}, error)
	VisitFunctionCast(node *CastFunction) (interface{}, error)
	VisitFunctionCaseWhenElse(node *CaseWhenElseFunction) (interface{}, error)
	VisitFunctionArg(node *FunctionArg) (interface{}, error)
}

Visitor represents a visitor to visit AST nodes recursively.

Jump to

Keyboard shortcuts

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