Documentation
¶
Index ¶
- Constants
- Variables
- func IsHintIgnore(hintName string) bool
- func MustRestoreToString(flag RestoreFlag, r Restorer) string
- func RestoreToString(flag RestoreFlag, r Restorer) (string, error)
- func WriteID(sb *strings.Builder, field string)
- func WriteString(sb *strings.Builder, str string)
- type AggrFunction
- func (af *AggrFunction) Accept(visitor Visitor) (interface{}, error)
- func (af *AggrFunction) Aggregator() (string, bool)
- func (af *AggrFunction) Args() []*FunctionArg
- func (af *AggrFunction) EnableCountStar()
- func (af *AggrFunction) IsCountStar() bool
- func (af *AggrFunction) Name() string
- func (af *AggrFunction) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error
- type AggrFunctionFlag
- type AlgorithmType
- type AlterTableSpecStatement
- type AlterTableStatement
- type AlterTableType
- type AlwaysReturnSelfVisitor
- func (a AlwaysReturnSelfVisitor) VisitAtomColumn(node ColumnNameExpressionAtom) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitAtomConstant(node *ConstantExpressionAtom) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitAtomFunction(node *FunctionCallExpressionAtom) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitAtomInterval(node *IntervalExpressionAtom) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitAtomMath(node *MathExpressionAtom) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitAtomNested(node *NestedExpressionAtom) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitAtomSystemVariable(node *SystemVariableExpressionAtom) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitAtomUnary(node *UnaryExpressionAtom) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitAtomVariable(node VariableExpressionAtom) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitFunction(node *Function) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitFunctionAggregate(node *AggrFunction) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitFunctionArg(node *FunctionArg) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitFunctionCaseWhenElse(node *CaseWhenElseFunction) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitFunctionCast(node *CastFunction) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitGroupBy(node *GroupByNode) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitGroupByItem(node *GroupByItem) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitJoin(node *JoinNode) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitLimit(node *LimitNode) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitLogicalExpression(node *LogicalExpressionNode) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitNotExpression(node *NotExpressionNode) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitOrderBy(node OrderByNode) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitOrderByItem(node *OrderByItem) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitPredicateAtom(node *AtomPredicateNode) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitPredicateBetween(node *BetweenPredicateNode) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitPredicateBinaryComparison(node *BinaryComparisonPredicateNode) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitPredicateExpression(node *PredicateExpressionNode) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitPredicateIn(node *InPredicateNode) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitPredicateLike(node *LikePredicateNode) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitPredicateRegexp(node *RegexpPredicationNode) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitSelectElementColumn(node *SelectElementColumn) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitSelectElementExpr(node *SelectElementExpr) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitSelectElementFunction(node *SelectElementFunction) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitSelectElementWildcard(node *SelectElementAll) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitSelectStatement(node *SelectStatement) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitTableName(node TableName) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitTableSource(node *TableSourceNode) (interface{}, error)
- func (a AlwaysReturnSelfVisitor) VisitUnionStatement(node *UnionSelectStatement) (interface{}, error)
- type AnalyzeTableStatement
- type AtomPredicateNode
- type BaseInsertStatement
- type BaseShow
- type BaseShowWithSingleColumn
- type BaseVisitor
- func (b BaseVisitor) VisitAtomColumn(node ColumnNameExpressionAtom) (interface{}, error)
- func (b BaseVisitor) VisitAtomConstant(node *ConstantExpressionAtom) (interface{}, error)
- func (b BaseVisitor) VisitAtomFunction(node *FunctionCallExpressionAtom) (interface{}, error)
- func (b BaseVisitor) VisitAtomInterval(node *IntervalExpressionAtom) (interface{}, error)
- func (b BaseVisitor) VisitAtomMath(node *MathExpressionAtom) (interface{}, error)
- func (b BaseVisitor) VisitAtomNested(node *NestedExpressionAtom) (interface{}, error)
- func (b BaseVisitor) VisitAtomSystemVariable(node *SystemVariableExpressionAtom) (interface{}, error)
- func (b BaseVisitor) VisitAtomUnary(node *UnaryExpressionAtom) (interface{}, error)
- func (b BaseVisitor) VisitAtomVariable(node VariableExpressionAtom) (interface{}, error)
- func (b BaseVisitor) VisitFunction(node *Function) (interface{}, error)
- func (b BaseVisitor) VisitFunctionAggregate(node *AggrFunction) (interface{}, error)
- func (b BaseVisitor) VisitFunctionArg(node *FunctionArg) (interface{}, error)
- func (b BaseVisitor) VisitFunctionCaseWhenElse(node *CaseWhenElseFunction) (interface{}, error)
- func (b BaseVisitor) VisitFunctionCast(node *CastFunction) (interface{}, error)
- func (b BaseVisitor) VisitGroupBy(node *GroupByNode) (interface{}, error)
- func (b BaseVisitor) VisitGroupByItem(node *GroupByItem) (interface{}, error)
- func (b BaseVisitor) VisitJoin(node *JoinNode) (interface{}, error)
- func (b BaseVisitor) VisitLimit(node *LimitNode) (interface{}, error)
- func (b BaseVisitor) VisitLogicalExpression(node *LogicalExpressionNode) (interface{}, error)
- func (b BaseVisitor) VisitNotExpression(node *NotExpressionNode) (interface{}, error)
- func (b BaseVisitor) VisitOrderBy(node OrderByNode) (interface{}, error)
- func (b BaseVisitor) VisitOrderByItem(node *OrderByItem) (interface{}, error)
- func (b BaseVisitor) VisitPredicateAtom(node *AtomPredicateNode) (interface{}, error)
- func (b BaseVisitor) VisitPredicateBetween(node *BetweenPredicateNode) (interface{}, error)
- func (b BaseVisitor) VisitPredicateBinaryComparison(node *BinaryComparisonPredicateNode) (interface{}, error)
- func (b BaseVisitor) VisitPredicateExpression(node *PredicateExpressionNode) (interface{}, error)
- func (b BaseVisitor) VisitPredicateIn(node *InPredicateNode) (interface{}, error)
- func (b BaseVisitor) VisitPredicateLike(node *LikePredicateNode) (interface{}, error)
- func (b BaseVisitor) VisitPredicateRegexp(node *RegexpPredicationNode) (interface{}, error)
- func (b BaseVisitor) VisitSelectElementColumn(node *SelectElementColumn) (interface{}, error)
- func (b BaseVisitor) VisitSelectElementExpr(node *SelectElementExpr) (interface{}, error)
- func (b BaseVisitor) VisitSelectElementFunction(node *SelectElementFunction) (interface{}, error)
- func (b BaseVisitor) VisitSelectElementWildcard(node *SelectElementAll) (interface{}, error)
- func (b BaseVisitor) VisitSelectStatement(node *SelectStatement) (interface{}, error)
- func (b BaseVisitor) VisitTableName(node TableName) (interface{}, error)
- func (b BaseVisitor) VisitTableSource(node *TableSourceNode) (interface{}, error)
- func (b BaseVisitor) VisitUnionStatement(node *UnionSelectStatement) (interface{}, error)
- type BetweenPredicateNode
- type BinaryComparisonPredicateNode
- type CaseWhenBranch
- type CaseWhenElseFunction
- type CastFunction
- func (c *CastFunction) Accept(visitor Visitor) (interface{}, error)
- func (c *CastFunction) GetCast() (*ConvertDataType, bool)
- func (c *CastFunction) GetCharset() (string, bool)
- func (c *CastFunction) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error
- func (c *CastFunction) SetSource(src ExpressionNode)
- func (c *CastFunction) Source() ExpressionNode
- type CastType
- type CheckTableStmt
- type ColumnDefine
- type ColumnNameExpressionAtom
- func (c ColumnNameExpressionAtom) Accept(visitor Visitor) (interface{}, error)
- func (c ColumnNameExpressionAtom) Clone() ExpressionAtom
- func (c ColumnNameExpressionAtom) Prefix() string
- func (c ColumnNameExpressionAtom) Restore(flag RestoreFlag, sb *strings.Builder, _ *[]int) error
- func (c ColumnNameExpressionAtom) String() string
- func (c ColumnNameExpressionAtom) Suffix() string
- type ColumnOption
- type ColumnOptionType
- type ColumnPosition
- type ColumnPositionType
- type ConstantExpressionAtom
- func (c *ConstantExpressionAtom) Accept(visitor Visitor) (interface{}, error)
- func (c *ConstantExpressionAtom) Clone() ExpressionAtom
- func (c *ConstantExpressionAtom) IsNull() bool
- func (c *ConstantExpressionAtom) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error
- func (c *ConstantExpressionAtom) String() string
- func (c *ConstantExpressionAtom) Value() interface{}
- type Constraint
- type ConstraintType
- type ConvertDataType
- type CreateIndexStatement
- type CreateTableStmt
- type DeleteStatement
- type DescribeStatement
- type DropIndexStatement
- type DropTableStatement
- type DropTriggerStatement
- type ExplainStatement
- type ExpressionAtom
- type ExpressionMode
- type ExpressionNode
- type FromDatabase
- type FromNode
- type FromTable
- type Function
- type FunctionArg
- type FunctionArgType
- type FunctionCallExpressionAtom
- type FunctionType
- type GroupByItem
- type GroupByNode
- type HintItem
- type HintNode
- type HintType
- type InPredicateNode
- type IndexHint
- type IndexKeyType
- type IndexLockAndAlgorithm
- type IndexOption
- type IndexPartSpec
- type IndexType
- type InsertSelectStatement
- func (b InsertSelectStatement) Flag() uint8
- func (b InsertSelectStatement) IsDelayed() bool
- func (b InsertSelectStatement) IsHighPriority() bool
- func (b InsertSelectStatement) IsIgnore() bool
- func (b InsertSelectStatement) IsLowPriority() bool
- func (b InsertSelectStatement) IsSetSyntax() bool
- func (is *InsertSelectStatement) Mode() SQLType
- func (b InsertSelectStatement) Priority() (priority string, ok bool)
- func (is *InsertSelectStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error
- func (is *InsertSelectStatement) Select() *SelectStatement
- func (b InsertSelectStatement) SetFlag(flag uint8)
- type InsertStatement
- func (b InsertStatement) Flag() uint8
- func (b InsertStatement) IsDelayed() bool
- func (b InsertStatement) IsHighPriority() bool
- func (b InsertStatement) IsIgnore() bool
- func (b InsertStatement) IsLowPriority() bool
- func (b InsertStatement) IsSetSyntax() bool
- func (is *InsertStatement) Mode() SQLType
- func (b InsertStatement) Priority() (priority string, ok bool)
- func (is *InsertStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error
- func (b InsertStatement) SetFlag(flag uint8)
- type IntervalExpressionAtom
- type JoinNode
- type JoinType
- type KillStmt
- type LikePredicateNode
- type LimitNode
- func (ln *LimitNode) HasOffset() bool
- func (ln *LimitNode) IsLimitVar() bool
- func (ln *LimitNode) IsOffsetVar() bool
- func (ln *LimitNode) Limit() int64
- func (ln *LimitNode) Offset() int64
- func (ln *LimitNode) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error
- func (ln *LimitNode) SetHasOffset()
- func (ln *LimitNode) SetLimit(n int64)
- func (ln *LimitNode) SetLimitVar()
- func (ln *LimitNode) SetOffset(n int64)
- func (ln *LimitNode) SetOffsetVar()
- func (ln *LimitNode) UnsetHasOffset()
- func (ln *LimitNode) UnsetLimitVar()
- func (ln *LimitNode) UnsetOffsetVar()
- type LockType
- type LogicalExpressionNode
- type MathExpressionAtom
- type NestedExpressionAtom
- type Node
- type NotExpressionNode
- type OptimizeTableStatement
- type OrderByItem
- type OrderByNode
- type ParseOption
- type PredicateExpressionNode
- type PredicateNode
- type RegexpPredicationNode
- type RenameTableStatement
- type RepairTableStmt
- type ReplaceSelectStatement
- func (b ReplaceSelectStatement) Flag() uint8
- func (b ReplaceSelectStatement) IsDelayed() bool
- func (b ReplaceSelectStatement) IsHighPriority() bool
- func (b ReplaceSelectStatement) IsIgnore() bool
- func (b ReplaceSelectStatement) IsLowPriority() bool
- func (b ReplaceSelectStatement) IsSetSyntax() bool
- func (r *ReplaceSelectStatement) Mode() SQLType
- func (b ReplaceSelectStatement) Priority() (priority string, ok bool)
- func (r *ReplaceSelectStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error
- func (b ReplaceSelectStatement) SetFlag(flag uint8)
- type ReplaceStatement
- func (b ReplaceStatement) Flag() uint8
- func (b ReplaceStatement) IsDelayed() bool
- func (b ReplaceStatement) IsHighPriority() bool
- func (b ReplaceStatement) IsIgnore() bool
- func (b ReplaceStatement) IsLowPriority() bool
- func (b ReplaceStatement) IsSetSyntax() bool
- func (r *ReplaceStatement) Mode() SQLType
- func (b ReplaceStatement) Priority() (priority string, ok bool)
- func (r *ReplaceStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error
- func (b ReplaceStatement) SetFlag(flag uint8)
- type RestoreFlag
- type Restorer
- type SQLType
- type SelectElement
- type SelectElementAll
- func (s *SelectElementAll) Accept(visitor Visitor) (interface{}, error)
- func (s *SelectElementAll) Alias() string
- func (s *SelectElementAll) DisplayName() string
- func (s *SelectElementAll) Prefix() string
- func (s *SelectElementAll) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error
- func (s *SelectElementAll) ToSelectString() string
- type SelectElementColumn
- func (s *SelectElementColumn) Accept(visitor Visitor) (interface{}, error)
- func (s *SelectElementColumn) Alias() string
- func (s *SelectElementColumn) DisplayName() string
- func (s *SelectElementColumn) Prefix() string
- func (s *SelectElementColumn) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error
- func (s *SelectElementColumn) Suffix() string
- func (s *SelectElementColumn) ToSelectString() string
- type SelectElementExpr
- func (s *SelectElementExpr) Accept(visitor Visitor) (interface{}, error)
- func (s *SelectElementExpr) Alias() string
- func (s *SelectElementExpr) DisplayName() string
- func (s *SelectElementExpr) Expression() ExpressionNode
- func (s *SelectElementExpr) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error
- func (s *SelectElementExpr) ToSelectString() string
- type SelectElementFunction
- func NewSelectElementAggrFunction(fun *AggrFunction, alias string) *SelectElementFunction
- func NewSelectElementCaseWhenFunction(fun *CaseWhenElseFunction, alias string) *SelectElementFunction
- func NewSelectElementCastFunction(fun *CastFunction, alias string) *SelectElementFunction
- func NewSelectElementFunction(fun *Function, alias string) *SelectElementFunction
- func (s *SelectElementFunction) Accept(visitor Visitor) (interface{}, error)
- func (s *SelectElementFunction) Alias() string
- func (s *SelectElementFunction) DisplayName() string
- func (s *SelectElementFunction) Function() Node
- func (s *SelectElementFunction) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error
- func (s *SelectElementFunction) SetAggrFunction(fn *AggrFunction)
- func (s *SelectElementFunction) SetAlias(alias string)
- func (s *SelectElementFunction) SetCaseWhenElseFunction(fn *CaseWhenElseFunction)
- func (s *SelectElementFunction) SetCastFunction(fn *CastFunction)
- func (s *SelectElementFunction) SetFunction(fn *Function)
- func (s *SelectElementFunction) ToSelectString() string
- type SelectLock
- type SelectNode
- type SelectStatement
- type SetStatement
- type ShowCharset
- type ShowCollation
- type ShowColumns
- func (sh *ShowColumns) ColumnsFormat() string
- func (sh *ShowColumns) Extended() bool
- func (sh *ShowColumns) Full() bool
- func (sh *ShowColumns) IsExtended() bool
- func (sh *ShowColumns) IsFull() bool
- func (sh *ShowColumns) Like() (string, bool)
- func (sh *ShowColumns) Mode() SQLType
- func (sh *ShowColumns) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error
- func (sh *ShowColumns) Table() TableName
- func (sh *ShowColumns) TableFormat() string
- type ShowCreate
- type ShowCreateSequence
- type ShowCreateType
- type ShowDatabaseRule
- type ShowDatabases
- type ShowIndex
- type ShowMasterStatus
- type ShowNodes
- type ShowOpenTables
- type ShowProcessList
- type ShowReplicaStatus
- type ShowReplicas
- type ShowShardingTable
- type ShowStatus
- type ShowTableRule
- type ShowTableStatus
- type ShowTables
- type ShowTopology
- type ShowUsers
- type ShowVariables
- type ShowWarnings
- type Statement
- type SystemVariableExpressionAtom
- func (sy *SystemVariableExpressionAtom) Accept(visitor Visitor) (interface{}, error)
- func (sy *SystemVariableExpressionAtom) Clone() ExpressionAtom
- func (sy *SystemVariableExpressionAtom) IsCompat80() bool
- func (sy *SystemVariableExpressionAtom) Restore(rf RestoreFlag, sb *strings.Builder, _ *[]int) error
- type TableName
- func (t TableName) Accept(visitor Visitor) (interface{}, error)
- func (t TableName) Prefix() (prefix string)
- func (t TableName) ResetSuffix(suffix string) TableName
- func (t TableName) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error
- func (t TableName) String() string
- func (t TableName) Suffix() string
- type TableSourceItem
- type TableSourceNode
- type TableToTable
- type TruncateStatement
- type UnaryExpressionAtom
- type UnionSelectStatement
- type UnionStatementItem
- type UnionType
- type UpdateElement
- type UpdateStatement
- type VariableExpressionAtom
- type VariablePair
- type Visitor
Constants ¶
const ( AggrAvg = "AVG" AggrMax = "MAX" AggrMin = "MIN" AggrSum = "SUM" AggrCount = "COUNT" )
const ( Distinct = "DISTINCT" All = "ALL" )
Variables ¶
var TruePredicate = func(row proto.Row) bool { return true }
Functions ¶
func IsHintIgnore ¶
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 WriteString ¶
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 (a *AtomPredicateNode) Column() (ColumnNameExpressionAtom, bool)
func (*AtomPredicateNode) Restore ¶
func (a *AtomPredicateNode) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error
type BaseInsertStatement ¶
type BaseShow ¶
type BaseShow struct {
// contains filtered or unexported fields
}
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 (b *BetweenPredicateNode) Clone() PredicateNode
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 (b *BinaryComparisonPredicateNode) Clone() PredicateNode
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 )
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 (c ColumnNameExpressionAtom) Clone() ExpressionAtom
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 (c *ConstantExpressionAtom) Clone() ExpressionAtom
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 ¶
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 ¶
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 ¶
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 ¶
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 Function ¶
type Function struct {
// contains filtered or unexported fields
}
func (*Function) Args ¶
func (f *Function) Args() []*FunctionArg
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 (f *FunctionCallExpressionAtom) Clone() ExpressionAtom
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 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) IndexHintType ¶
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 ¶
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 InsertSelectStatement ¶
type InsertSelectStatement struct {
// contains filtered or unexported fields
}
func (InsertSelectStatement) IsHighPriority ¶
func (b InsertSelectStatement) IsHighPriority() 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) Restore ¶
func (is *InsertSelectStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error
func (*InsertSelectStatement) Select ¶
func (is *InsertSelectStatement) Select() *SelectStatement
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) IsHighPriority ¶
func (b InsertStatement) IsHighPriority() 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) Restore ¶
func (is *InsertStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error
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 (ie *IntervalExpressionAtom) Clone() ExpressionAtom
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 }
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) IsLimitVar ¶
func (*LimitNode) IsOffsetVar ¶
func (*LimitNode) SetHasOffset ¶
func (ln *LimitNode) SetHasOffset()
func (*LimitNode) SetLimitVar ¶
func (ln *LimitNode) SetLimitVar()
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 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 (l *LogicalExpressionNode) Clone() ExpressionNode
func (*LogicalExpressionNode) Mode ¶
func (l *LogicalExpressionNode) Mode() ExpressionMode
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 (m *MathExpressionAtom) Clone() ExpressionAtom
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 (n *NestedExpressionAtom) Clone() ExpressionAtom
func (*NestedExpressionAtom) Restore ¶
func (n *NestedExpressionAtom) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error
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 (n *NotExpressionNode) Mode() ExpressionMode
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 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 (a *PredicateExpressionNode) Clone() ExpressionNode
func (*PredicateExpressionNode) Mode ¶
func (a *PredicateExpressionNode) Mode() ExpressionMode
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 (rp *RegexpPredicationNode) Clone() PredicateNode
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) IsHighPriority ¶
func (b ReplaceSelectStatement) IsHighPriority() 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) Restore ¶
func (r *ReplaceSelectStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error
type ReplaceStatement ¶
type ReplaceStatement struct { Values [][]ExpressionNode // contains filtered or unexported fields }
func (ReplaceStatement) IsHighPriority ¶
func (b ReplaceStatement) IsHighPriority() 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) Restore ¶
func (r *ReplaceStatement) Restore(flag RestoreFlag, sb *strings.Builder, args *[]int) error
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 )
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 ¶
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) 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 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 ¶
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 ¶
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 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 ¶
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 ¶
FromStmtNode converts raw ast node to Statement.
type SystemVariableExpressionAtom ¶
func (*SystemVariableExpressionAtom) Accept ¶
func (sy *SystemVariableExpressionAtom) Accept(visitor Visitor) (interface{}, error)
func (*SystemVariableExpressionAtom) Clone ¶
func (sy *SystemVariableExpressionAtom) Clone() ExpressionAtom
func (*SystemVariableExpressionAtom) IsCompat80 ¶
func (sy *SystemVariableExpressionAtom) IsCompat80() bool
func (*SystemVariableExpressionAtom) Restore ¶
func (sy *SystemVariableExpressionAtom) Restore(rf RestoreFlag, sb *strings.Builder, _ *[]int) error
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 ¶
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 (u *UnaryExpressionAtom) Clone() ExpressionAtom
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 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 (v VariableExpressionAtom) Clone() ExpressionAtom
func (VariableExpressionAtom) N ¶
func (v VariableExpressionAtom) N() int
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.
Source Files
¶
- alter_table.go
- analyze_table.go
- ast.go
- check_table.go
- create_index.go
- create_table.go
- delete.go
- describe.go
- drop_index.go
- drop_table.go
- expression.go
- expression_atom.go
- function.go
- insert.go
- join.go
- kill.go
- misc.go
- model.go
- optimize_table.go
- predicate.go
- proto.go
- rename_table.go
- repair_table.go
- restore.go
- select.go
- select_element.go
- set_variable.go
- show.go
- table_source.go
- trigger.go
- truncate.go
- union.go
- update.go
- visitor.go