Documentation
¶
Overview ¶
Package parser converts TiDB parser nodes into sql-gunyu's MySQL AST.
Deprecated: this package remains exported for compatibility with existing low-level cost and explain APIs. Application code should use pkg/mysql Agent methods instead of depending on parser or AST types directly.
Index ¶
- Constants
- func ExtractColumnAndValue(expr *BinaryOperationExpr) (columnNameL string, value any, ok bool)
- func ExtractColumnNameL(expr ExprNode) string
- func ExtractColumnSchemaTableNameL(expr ExprNode) (schemaName, tableName, columnName string)
- func ExtractValueFromExpr(expr ExprNode) any
- func IsNullValue(expr ExprNode) bool
- func ParseOneStmt(sql string) (ast.StmtNode, error)
- func WalkExprColumnsReadOnly(expr ExprNode, fn func(*ColumnName))
- func WalkExprColumnsScopedReadOnly(expr ExprNode, fn func(col *ColumnName, inNestedQuery bool))
- func WalkJoinColumnsReadOnly(node ResultSetNode, fn func(*ColumnName))
- func WalkJoinColumnsScopedReadOnly(node ResultSetNode, fn func(col *ColumnName, inNestedQuery bool))
- func WalkResultSetColumnsReadOnly(node ResultSetNode, fn func(*ColumnName))
- type AdminStmt
- type AdminStmtType
- type AggregateFuncExpr
- func (afe *AggregateFuncExpr) Accept(visitor Visitor) (Node, bool)
- func (en *AggregateFuncExpr) Format(w io.Writer)
- func (en *AggregateFuncExpr) GetFlag() uint64
- func (en *AggregateFuncExpr) GetType() *FieldType
- func (en *AggregateFuncExpr) GetValue() interface{}
- func (en *AggregateFuncExpr) SetFlag(flag uint64)
- func (en *AggregateFuncExpr) SetType(tp *FieldType)
- func (en *AggregateFuncExpr) SetValue(val interface{})
- type AlgorithmType
- type AlterDatabaseStmt
- type AlterOrderItem
- type AlterTableSpec
- type AlterTableStmt
- type AlterTableType
- type AnalyzeTableStmt
- type AsOfClause
- type Assignment
- type AuthOption
- type BeginStmt
- type BetweenExpr
- func (be *BetweenExpr) Accept(visitor Visitor) (Node, bool)
- func (en *BetweenExpr) Format(w io.Writer)
- func (en *BetweenExpr) GetFlag() uint64
- func (en *BetweenExpr) GetType() *FieldType
- func (en *BetweenExpr) GetValue() interface{}
- func (en *BetweenExpr) SetFlag(flag uint64)
- func (en *BetweenExpr) SetType(tp *FieldType)
- func (en *BetweenExpr) SetValue(val interface{})
- type BinaryOperationExpr
- func (boe *BinaryOperationExpr) Accept(visitor Visitor) (Node, bool)
- func (en *BinaryOperationExpr) Format(w io.Writer)
- func (en *BinaryOperationExpr) GetFlag() uint64
- func (en *BinaryOperationExpr) GetType() *FieldType
- func (en *BinaryOperationExpr) GetValue() interface{}
- func (en *BinaryOperationExpr) SetFlag(flag uint64)
- func (en *BinaryOperationExpr) SetType(tp *FieldType)
- func (en *BinaryOperationExpr) SetValue(val interface{})
- type BoundType
- type ByItem
- type CIStr
- type CallStmt
- type CaseExpr
- func (ce *CaseExpr) Accept(visitor Visitor) (Node, bool)
- func (en *CaseExpr) Format(w io.Writer)
- func (en *CaseExpr) GetFlag() uint64
- func (en *CaseExpr) GetType() *FieldType
- func (en *CaseExpr) GetValue() interface{}
- func (en *CaseExpr) SetFlag(flag uint64)
- func (en *CaseExpr) SetType(tp *FieldType)
- func (en *CaseExpr) SetValue(val interface{})
- type CastFunctionType
- type ColumnChoice
- type ColumnDef
- type ColumnName
- func (n *ColumnName) Accept(v Visitor) (Node, bool)
- func (n *ColumnName) ActualName() CIStr
- func (n *ColumnName) ActualSchema() CIStr
- func (n *ColumnName) ActualTable() CIStr
- func (n *ColumnName) GetBaseTableInfo() (schema, table, column CIStr)
- func (n *ColumnName) GetColumnNameL() string
- func (n *ColumnName) GetColumnNameO() string
- func (n *ColumnName) GetOriginalTableNameL() string
- func (n *ColumnName) GetRealColumnNameL() string
- func (n *ColumnName) GetResolvedPhysicalTableNameL() string
- func (n *ColumnName) GetSchemaNameL() string
- func (n *ColumnName) GetTableNameL() string
- func (n *ColumnName) Match(b *ColumnName) bool
- func (n *ColumnName) OrigColName() (ret string)
- func (n *ColumnName) OriginTextPosition() int
- func (n *ColumnName) OriginalName() CIStr
- func (n *ColumnName) OriginalSchema() CIStr
- func (n *ColumnName) OriginalTable() CIStr
- func (n *ColumnName) OriginalText() string
- func (n *ColumnName) RealItem() *ColumnName
- func (n *ColumnName) SetOriginTextPosition(offset int)
- func (n *ColumnName) SetText(text string)
- func (n *ColumnName) String() string
- func (n *ColumnName) Text() string
- type ColumnNameExpr
- func (n *ColumnNameExpr) Accept(v Visitor) (Node, bool)
- func (en *ColumnNameExpr) Format(w io.Writer)
- func (en *ColumnNameExpr) GetFlag() uint64
- func (en *ColumnNameExpr) GetType() *FieldType
- func (en *ColumnNameExpr) GetValue() interface{}
- func (en *ColumnNameExpr) SetFlag(flag uint64)
- func (en *ColumnNameExpr) SetType(tp *FieldType)
- func (en *ColumnNameExpr) SetValue(val interface{})
- type ColumnOption
- type ColumnOptionType
- type ColumnPosition
- type ColumnPositionType
- type CommitStmt
- type CommonTableExpression
- func (n *CommonTableExpression) Accept(v Visitor) (Node, bool)
- func (n *CommonTableExpression) OriginTextPosition() int
- func (n *CommonTableExpression) OriginalText() string
- func (n *CommonTableExpression) SetOriginTextPosition(offset int)
- func (n *CommonTableExpression) SetText(text string)
- func (n *CommonTableExpression) Text() string
- type CompareSubqueryExpr
- func (n *CompareSubqueryExpr) Accept(v Visitor) (Node, bool)
- func (en *CompareSubqueryExpr) Format(w io.Writer)
- func (en *CompareSubqueryExpr) GetFlag() uint64
- func (en *CompareSubqueryExpr) GetType() *FieldType
- func (en *CompareSubqueryExpr) GetValue() interface{}
- func (en *CompareSubqueryExpr) SetFlag(flag uint64)
- func (en *CompareSubqueryExpr) SetType(tp *FieldType)
- func (en *CompareSubqueryExpr) SetValue(val interface{})
- type CompletionType
- type Constraint
- type ConstraintType
- type CreateDatabaseStmt
- type CreateIndexStmt
- type CreateTableStmt
- type CreateViewStmt
- type DDLNode
- type DMLNode
- type DatabaseOption
- type DatabaseOptionType
- type DateArithType
- type Datum
- func (d *Datum) Clone() *Datum
- func (d *Datum) Copy(dst *Datum)
- func (d *Datum) GetBytes() []byte
- func (d *Datum) GetFloat32() float32
- func (d *Datum) GetFloat64() float64
- func (d *Datum) GetInt64() int64
- func (d *Datum) GetInterface() any
- func (d *Datum) GetString() string
- func (d *Datum) GetUint64() uint64
- func (d *Datum) GetValue() any
- func (d *Datum) IsNull() bool
- func (d *Datum) Kind() byte
- func (d *Datum) SetBytes(b []byte)
- func (d *Datum) SetBytesAsString(b []byte)
- func (d *Datum) SetFloat32(f float32)
- func (d *Datum) SetFloat64(f float64)
- func (d *Datum) SetInt64(i int64)
- func (d *Datum) SetInterface(x any)
- func (d *Datum) SetKind(k byte)
- func (d *Datum) SetNull()
- func (d *Datum) SetString(s string)
- func (d *Datum) SetUint64(u uint64)
- func (d *Datum) SetValue(val any)
- func (d *Datum) String() string
- type DefaultExpr
- func (n *DefaultExpr) Accept(v Visitor) (Node, bool)
- func (en *DefaultExpr) Format(w io.Writer)
- func (en *DefaultExpr) GetFlag() uint64
- func (en *DefaultExpr) GetType() *FieldType
- func (en *DefaultExpr) GetValue() interface{}
- func (en *DefaultExpr) SetFlag(flag uint64)
- func (en *DefaultExpr) SetType(tp *FieldType)
- func (en *DefaultExpr) SetValue(val interface{})
- type DeleteStmt
- type DeleteTableList
- func (n *DeleteTableList) Accept(v Visitor) (Node, bool)
- func (n *DeleteTableList) OriginTextPosition() int
- func (n *DeleteTableList) OriginalText() string
- func (n *DeleteTableList) SetOriginTextPosition(offset int)
- func (n *DeleteTableList) SetText(text string)
- func (n *DeleteTableList) Text() string
- type DoStmt
- type DropDatabaseStmt
- type DropIndexStmt
- type DropTableStmt
- type ExistsSubqueryExpr
- func (n *ExistsSubqueryExpr) Accept(v Visitor) (Node, bool)
- func (en *ExistsSubqueryExpr) Format(w io.Writer)
- func (en *ExistsSubqueryExpr) GetFlag() uint64
- func (en *ExistsSubqueryExpr) GetType() *FieldType
- func (en *ExistsSubqueryExpr) GetValue() interface{}
- func (en *ExistsSubqueryExpr) SetFlag(flag uint64)
- func (en *ExistsSubqueryExpr) SetType(tp *FieldType)
- func (en *ExistsSubqueryExpr) SetValue(val interface{})
- type ExplainFormatType
- type ExplainStmt
- type ExprNode
- type FieldList
- type FieldResolver
- type FieldTranslator
- type FieldType
- type FlushStmt
- type FlushStmtType
- type FrameBound
- type FrameClause
- type FrameExtent
- type FrameType
- type FulltextSearchModifier
- type FuncCallExpr
- type FuncCallExprType
- type FuncCastExpr
- type FuncNode
- type GetFormatSelectorExpr
- func (n *GetFormatSelectorExpr) Accept(v Visitor) (Node, bool)
- func (en *GetFormatSelectorExpr) Format(w io.Writer)
- func (en *GetFormatSelectorExpr) GetFlag() uint64
- func (en *GetFormatSelectorExpr) GetType() *FieldType
- func (en *GetFormatSelectorExpr) GetValue() interface{}
- func (en *GetFormatSelectorExpr) SetFlag(flag uint64)
- func (en *GetFormatSelectorExpr) SetType(tp *FieldType)
- func (en *GetFormatSelectorExpr) SetValue(val interface{})
- type GetFormatSelectorType
- type GroupByClause
- type HandleRange
- type HavingClause
- type HintScope
- type HintType
- type HistogramOperation
- type IndexHint
- type IndexHintScope
- type IndexHintType
- type IndexKeyType
- type IndexLockAndAlgorithm
- func (n *IndexLockAndAlgorithm) Accept(v Visitor) (Node, bool)
- func (n *IndexLockAndAlgorithm) OriginTextPosition() int
- func (n *IndexLockAndAlgorithm) OriginalText() string
- func (n *IndexLockAndAlgorithm) SetOriginTextPosition(offset int)
- func (n *IndexLockAndAlgorithm) SetText(text string)
- func (n *IndexLockAndAlgorithm) Text() string
- type IndexOption
- type IndexPartSpecification
- func (n *IndexPartSpecification) Accept(v Visitor) (Node, bool)
- func (n *IndexPartSpecification) OriginTextPosition() int
- func (n *IndexPartSpecification) OriginalText() string
- func (n *IndexPartSpecification) SetOriginTextPosition(offset int)
- func (n *IndexPartSpecification) SetText(text string)
- func (n *IndexPartSpecification) Text() string
- type IndexType
- type IndexVisibility
- type InsertStmt
- type IsNullExpr
- func (ine *IsNullExpr) Accept(visitor Visitor) (Node, bool)
- func (en *IsNullExpr) Format(w io.Writer)
- func (en *IsNullExpr) GetFlag() uint64
- func (en *IsNullExpr) GetType() *FieldType
- func (en *IsNullExpr) GetValue() interface{}
- func (en *IsNullExpr) SetFlag(flag uint64)
- func (en *IsNullExpr) SetType(tp *FieldType)
- func (en *IsNullExpr) SetValue(val interface{})
- type IsTruthExpr
- func (ite *IsTruthExpr) Accept(visitor Visitor) (Node, bool)
- func (en *IsTruthExpr) Format(w io.Writer)
- func (en *IsTruthExpr) GetFlag() uint64
- func (en *IsTruthExpr) GetType() *FieldType
- func (en *IsTruthExpr) GetValue() interface{}
- func (en *IsTruthExpr) SetFlag(flag uint64)
- func (en *IsTruthExpr) SetType(tp *FieldType)
- func (en *IsTruthExpr) SetValue(val interface{})
- type Join
- type JoinType
- type KillStmt
- type Limit
- type LockTablesStmt
- type LockType
- type LogType
- type MatchAgainst
- func (n *MatchAgainst) Accept(v Visitor) (Node, bool)
- func (en *MatchAgainst) Format(w io.Writer)
- func (en *MatchAgainst) GetFlag() uint64
- func (en *MatchAgainst) GetType() *FieldType
- func (en *MatchAgainst) GetValue() interface{}
- func (en *MatchAgainst) SetFlag(flag uint64)
- func (en *MatchAgainst) SetType(tp *FieldType)
- func (en *MatchAgainst) SetValue(val interface{})
- type MatchType
- type MaxValueExpr
- func (n *MaxValueExpr) Accept(v Visitor) (Node, bool)
- func (en *MaxValueExpr) Format(w io.Writer)
- func (en *MaxValueExpr) GetFlag() uint64
- func (en *MaxValueExpr) GetType() *FieldType
- func (en *MaxValueExpr) GetValue() interface{}
- func (en *MaxValueExpr) SetFlag(flag uint64)
- func (en *MaxValueExpr) SetType(tp *FieldType)
- func (en *MaxValueExpr) SetValue(val interface{})
- type NameResolutionContext
- type NameResolutionContextState
- type NoOpTableProvider
- type Node
- type OnCondition
- type OnDeleteOpt
- type OnDuplicateKeyHandlingType
- type OnUpdateOpt
- type Op
- type OrderByClause
- type ParenthesesExpr
- func (pe *ParenthesesExpr) Accept(visitor Visitor) (Node, bool)
- func (en *ParenthesesExpr) Format(w io.Writer)
- func (en *ParenthesesExpr) GetFlag() uint64
- func (en *ParenthesesExpr) GetType() *FieldType
- func (en *ParenthesesExpr) GetValue() interface{}
- func (en *ParenthesesExpr) SetFlag(flag uint64)
- func (en *ParenthesesExpr) SetType(tp *FieldType)
- func (en *ParenthesesExpr) SetValue(val interface{})
- type PartitionByClause
- func (n *PartitionByClause) Accept(v Visitor) (Node, bool)
- func (n *PartitionByClause) OriginTextPosition() int
- func (n *PartitionByClause) OriginalText() string
- func (n *PartitionByClause) SetOriginTextPosition(offset int)
- func (n *PartitionByClause) SetText(text string)
- func (n *PartitionByClause) Text() string
- type PartitionDefinition
- func (n *PartitionDefinition) Accept(v Visitor) (Node, bool)
- func (n *PartitionDefinition) OriginTextPosition() int
- func (n *PartitionDefinition) OriginalText() string
- func (n *PartitionDefinition) SetOriginTextPosition(offset int)
- func (n *PartitionDefinition) SetText(text string)
- func (n *PartitionDefinition) Text() string
- type PartitionOptions
- func (n *PartitionOptions) Accept(v Visitor) (Node, bool)
- func (n *PartitionOptions) OriginTextPosition() int
- func (n *PartitionOptions) OriginalText() string
- func (n *PartitionOptions) SetOriginTextPosition(offset int)
- func (n *PartitionOptions) SetText(text string)
- func (n *PartitionOptions) Text() string
- type PartitionType
- type PatternInExpr
- func (pie *PatternInExpr) Accept(visitor Visitor) (Node, bool)
- func (en *PatternInExpr) Format(w io.Writer)
- func (en *PatternInExpr) GetFlag() uint64
- func (en *PatternInExpr) GetType() *FieldType
- func (en *PatternInExpr) GetValue() interface{}
- func (en *PatternInExpr) SetFlag(flag uint64)
- func (en *PatternInExpr) SetType(tp *FieldType)
- func (en *PatternInExpr) SetValue(val interface{})
- type PatternLikeOrIlikeExpr
- func (plie *PatternLikeOrIlikeExpr) Accept(visitor Visitor) (Node, bool)
- func (en *PatternLikeOrIlikeExpr) Format(w io.Writer)
- func (en *PatternLikeOrIlikeExpr) GetFlag() uint64
- func (en *PatternLikeOrIlikeExpr) GetType() *FieldType
- func (en *PatternLikeOrIlikeExpr) GetValue() interface{}
- func (en *PatternLikeOrIlikeExpr) SetFlag(flag uint64)
- func (en *PatternLikeOrIlikeExpr) SetType(tp *FieldType)
- func (en *PatternLikeOrIlikeExpr) SetValue(val interface{})
- type PatternRegexpExpr
- func (pre *PatternRegexpExpr) Accept(visitor Visitor) (Node, bool)
- func (en *PatternRegexpExpr) Format(w io.Writer)
- func (en *PatternRegexpExpr) GetFlag() uint64
- func (en *PatternRegexpExpr) GetType() *FieldType
- func (en *PatternRegexpExpr) GetValue() interface{}
- func (en *PatternRegexpExpr) SetFlag(flag uint64)
- func (en *PatternRegexpExpr) SetType(tp *FieldType)
- func (en *PatternRegexpExpr) SetValue(val interface{})
- type PositionExpr
- func (pe *PositionExpr) Accept(visitor Visitor) (Node, bool)
- func (en *PositionExpr) Format(w io.Writer)
- func (en *PositionExpr) GetFlag() uint64
- func (en *PositionExpr) GetType() *FieldType
- func (en *PositionExpr) GetValue() interface{}
- func (en *PositionExpr) SetFlag(flag uint64)
- func (en *PositionExpr) SetType(tp *FieldType)
- func (en *PositionExpr) SetValue(val interface{})
- type QueryContextType
- type ReferOptionType
- type ReferenceDef
- type ReleaseSavepointStmt
- type RenameTableStmt
- type ResolvedField
- type ResolvedFieldList
- type ResultSetNode
- type RollbackStmt
- type RowExpr
- func (re *RowExpr) Accept(visitor Visitor) (Node, bool)
- func (en *RowExpr) Format(w io.Writer)
- func (en *RowExpr) GetFlag() uint64
- func (en *RowExpr) GetType() *FieldType
- func (en *RowExpr) GetValue() interface{}
- func (en *RowExpr) SetFlag(flag uint64)
- func (en *RowExpr) SetType(tp *FieldType)
- func (en *RowExpr) SetValue(val interface{})
- type RowFormat
- type SavepointStmt
- type SelectField
- type SelectLockInfo
- type SelectLockType
- type SelectStmt
- type SelectStmtKind
- type SelectStmtOpts
- type SetCollationExpr
- func (n *SetCollationExpr) Accept(v Visitor) (Node, bool)
- func (en *SetCollationExpr) Format(w io.Writer)
- func (en *SetCollationExpr) GetFlag() uint64
- func (en *SetCollationExpr) GetType() *FieldType
- func (en *SetCollationExpr) GetValue() interface{}
- func (en *SetCollationExpr) SetFlag(flag uint64)
- func (en *SetCollationExpr) SetType(tp *FieldType)
- func (en *SetCollationExpr) SetValue(val interface{})
- type SetOprSelectList
- func (n *SetOprSelectList) Accept(v Visitor) (Node, bool)
- func (n *SetOprSelectList) OriginTextPosition() int
- func (n *SetOprSelectList) OriginalText() string
- func (n *SetOprSelectList) SetOriginTextPosition(offset int)
- func (n *SetOprSelectList) SetText(text string)
- func (n *SetOprSelectList) Text() string
- type SetOprStmt
- type SetOprType
- type SetStmt
- type ShowSlow
- type ShowSlowKind
- type ShowSlowType
- type ShowStmt
- type ShowStmtType
- type SpecialFuncType
- type StatementScope
- type StmtNode
- type SubqueryExpr
- func (n *SubqueryExpr) Accept(v Visitor) (Node, bool)
- func (en *SubqueryExpr) Format(w io.Writer)
- func (en *SubqueryExpr) GetFlag() uint64
- func (en *SubqueryExpr) GetType() *FieldType
- func (en *SubqueryExpr) GetValue() interface{}
- func (en *SubqueryExpr) SetFlag(flag uint64)
- func (en *SubqueryExpr) SetType(tp *FieldType)
- func (en *SubqueryExpr) SetValue(val interface{})
- type TableInfoProvider
- type TableLock
- type TableLockType
- type TableName
- func (n *TableName) Accept(v Visitor) (Node, bool)
- func (n *TableName) GetNameL() string
- func (n *TableName) GetNameO() string
- func (n *TableName) OriginTextPosition() int
- func (n *TableName) OriginalText() string
- func (n *TableName) SetOriginTextPosition(offset int)
- func (n *TableName) SetText(text string)
- func (n *TableName) Text() string
- type TableNameExpr
- func (n *TableNameExpr) Accept(v Visitor) (Node, bool)
- func (en *TableNameExpr) Format(w io.Writer)
- func (en *TableNameExpr) GetFlag() uint64
- func (en *TableNameExpr) GetType() *FieldType
- func (en *TableNameExpr) GetValue() interface{}
- func (en *TableNameExpr) SetFlag(flag uint64)
- func (en *TableNameExpr) SetType(tp *FieldType)
- func (en *TableNameExpr) SetValue(val interface{})
- type TableOption
- type TableOptionType
- type TableRefsClause
- func (n *TableRefsClause) Accept(v Visitor) (Node, bool)
- func (n *TableRefsClause) OriginTextPosition() int
- func (n *TableRefsClause) OriginalText() string
- func (n *TableRefsClause) SetOriginTextPosition(offset int)
- func (n *TableRefsClause) SetText(text string)
- func (n *TableRefsClause) Text() string
- type TableSource
- func (n *TableSource) Accept(v Visitor) (Node, bool)
- func (n *TableSource) Alias() CIStr
- func (n *TableSource) IsAliased() bool
- func (n *TableSource) OriginTextPosition() int
- func (n *TableSource) OriginalText() string
- func (n *TableSource) SetOriginTextPosition(offset int)
- func (n *TableSource) SetText(text string)
- func (n *TableSource) Text() string
- type TableToTable
- type TemporaryKeyword
- type TimeUnitExpr
- func (n *TimeUnitExpr) Accept(v Visitor) (Node, bool)
- func (en *TimeUnitExpr) Format(w io.Writer)
- func (en *TimeUnitExpr) GetFlag() uint64
- func (en *TimeUnitExpr) GetType() *FieldType
- func (en *TimeUnitExpr) GetValue() interface{}
- func (en *TimeUnitExpr) SetFlag(flag uint64)
- func (en *TimeUnitExpr) SetType(tp *FieldType)
- func (en *TimeUnitExpr) SetValue(val interface{})
- type TimeUnitType
- type TrimDirectionExpr
- func (n *TrimDirectionExpr) Accept(v Visitor) (Node, bool)
- func (en *TrimDirectionExpr) Format(w io.Writer)
- func (en *TrimDirectionExpr) GetFlag() uint64
- func (en *TrimDirectionExpr) GetType() *FieldType
- func (en *TrimDirectionExpr) GetValue() interface{}
- func (en *TrimDirectionExpr) SetFlag(flag uint64)
- func (en *TrimDirectionExpr) SetType(tp *FieldType)
- func (en *TrimDirectionExpr) SetValue(val interface{})
- type TrimDirectionType
- type TruncateTableStmt
- type UnaryOperationExpr
- func (uoe *UnaryOperationExpr) Accept(visitor Visitor) (Node, bool)
- func (en *UnaryOperationExpr) Format(w io.Writer)
- func (en *UnaryOperationExpr) GetFlag() uint64
- func (en *UnaryOperationExpr) GetType() *FieldType
- func (en *UnaryOperationExpr) GetValue() interface{}
- func (en *UnaryOperationExpr) SetFlag(flag uint64)
- func (en *UnaryOperationExpr) SetType(tp *FieldType)
- func (en *UnaryOperationExpr) SetValue(val interface{})
- type UnlockTablesStmt
- type UpdateStmt
- type UseStmt
- type UserSpec
- type ValueExpr
- func (ve *ValueExpr) Accept(visitor Visitor) (Node, bool)
- func (en *ValueExpr) Format(w io.Writer)
- func (en *ValueExpr) GetFlag() uint64
- func (en *ValueExpr) GetType() *FieldType
- func (ve *ValueExpr) GetValue() any
- func (en *ValueExpr) SetFlag(flag uint64)
- func (en *ValueExpr) SetType(tp *FieldType)
- func (ve *ValueExpr) SetValue(val any)
- type ValuesExpr
- func (n *ValuesExpr) Accept(v Visitor) (Node, bool)
- func (en *ValuesExpr) Format(w io.Writer)
- func (en *ValuesExpr) GetFlag() uint64
- func (en *ValuesExpr) GetType() *FieldType
- func (en *ValuesExpr) GetValue() interface{}
- func (en *ValuesExpr) SetFlag(flag uint64)
- func (en *ValuesExpr) SetType(tp *FieldType)
- func (en *ValuesExpr) SetValue(val interface{})
- type VariableAssignment
- func (n *VariableAssignment) Accept(v Visitor) (Node, bool)
- func (n *VariableAssignment) OriginTextPosition() int
- func (n *VariableAssignment) OriginalText() string
- func (n *VariableAssignment) SetOriginTextPosition(offset int)
- func (n *VariableAssignment) SetText(text string)
- func (n *VariableAssignment) Text() string
- type VariableExpr
- func (n *VariableExpr) Accept(v Visitor) (Node, bool)
- func (en *VariableExpr) Format(w io.Writer)
- func (en *VariableExpr) GetFlag() uint64
- func (en *VariableExpr) GetType() *FieldType
- func (en *VariableExpr) GetValue() interface{}
- func (en *VariableExpr) SetFlag(flag uint64)
- func (en *VariableExpr) SetType(tp *FieldType)
- func (en *VariableExpr) SetValue(val interface{})
- type ViewAlgorithm
- type ViewCheckOption
- type ViewSecurity
- type Visitor
- type WhenClause
- func (wc *WhenClause) Accept(visitor Visitor) (Node, bool)
- func (en *WhenClause) Format(w io.Writer)
- func (en *WhenClause) GetFlag() uint64
- func (en *WhenClause) GetType() *FieldType
- func (en *WhenClause) GetValue() interface{}
- func (en *WhenClause) SetFlag(flag uint64)
- func (en *WhenClause) SetType(tp *FieldType)
- func (en *WhenClause) SetValue(val interface{})
- type WildCardField
- type WindowFuncExpr
- type WindowSpec
- type WithClause
Constants ¶
const ( FlagConstant uint64 = 0 FlagHasParamMarker uint64 = 1 << iota FlagHasFunc FlagHasReference FlagHasAggregateFunc FlagHasSubquery FlagHasVariable FlagHasDefault FlagPreEvaluated FlagHasWindowFunc )
Flags indicates whether an expression contains certain types of expression.
const ( LogicAnd = "and" Cast = "cast" LeftShift = "leftshift" RightShift = "rightshift" LogicOr = "or" GE = "ge" LE = "le" EQ = "eq" NE = "ne" LT = "lt" GT = "gt" Plus = "plus" Minus = "minus" And = "bitand" Or = "bitor" Mod = "mod" Xor = "bitxor" Div = "div" Mul = "mul" UnaryNot = "not" BitNeg = "bitneg" IntDiv = "intdiv" LogicXor = "xor" NullEQ = "nulleq" UnaryPlus = "unaryplus" UnaryMinus = "unaryminus" In = "in" Like = "like" Ilike = "ilike" Case = "case" Regexp = "regexp" RegexpLike = "regexp_like" RegexpSubstr = "regexp_substr" RegexpInStr = "regexp_instr" RegexpReplace = "regexp_replace" IsNull = "isnull" IsTruthWithoutNull = "istrue" IsTruthWithNull = "istrue_with_null" IsFalsity = "isfalse" RowFunc = "row" SetVar = "setvar" GetVar = "getvar" Values = "values" BitCount = "bit_count" GetParam = "getparam" // common functions Coalesce = "coalesce" Greatest = "greatest" Least = "least" Interval = "interval" // math functions Abs = "abs" Acos = "acos" Asin = "asin" Atan = "atan" Atan2 = "atan2" Ceil = "ceil" Ceiling = "ceiling" Conv = "conv" Cos = "cos" Cot = "cot" CRC32 = "crc32" Degrees = "degrees" Exp = "exp" Floor = "floor" Ln = "ln" Log = "log" Log2 = "log2" Log10 = "log10" PI = "pi" Pow = "pow" Power = "power" Radians = "radians" Rand = "rand" Round = "round" Sign = "sign" Sin = "sin" Sqrt = "sqrt" Tan = "tan" Truncate = "truncate" // time functions AddDate = "adddate" AddTime = "addtime" ConvertTz = "convert_tz" Curdate = "curdate" CurrentDate = "current_date" CurrentTime = "current_time" CurrentTimestamp = "current_timestamp" Curtime = "curtime" Date = "date" DateLiteral = "'tidb`.(dateliteral" DateAdd = "date_add" DateFormat = "date_format" DateSub = "date_sub" DateDiff = "datediff" Day = "day" DayName = "dayname" DayOfMonth = "dayofmonth" DayOfWeek = "dayofweek" DayOfYear = "dayofyear" Extract = "extract" FromDays = "from_days" FromUnixTime = "from_unixtime" GetFormat = "get_format" Hour = "hour" LocalTime = "localtime" LocalTimestamp = "localtimestamp" MakeDate = "makedate" MakeTime = "maketime" MicroSecond = "microsecond" Minute = "minute" Month = "month" MonthName = "monthname" Now = "now" PeriodAdd = "period_add" PeriodDiff = "period_diff" Quarter = "quarter" SecToTime = "sec_to_time" Second = "second" StrToDate = "str_to_date" SubDate = "subdate" SubTime = "subtime" Sysdate = "sysdate" Time = "time" TimeLiteral = "'tidb`.(timeliteral" TimeFormat = "time_format" TimeToSec = "time_to_sec" TimeDiff = "timediff" Timestamp = "timestamp" TimestampLiteral = "'tidb`.(timestampliteral" TimestampAdd = "timestampadd" TimestampDiff = "timestampdiff" ToDays = "to_days" ToSeconds = "to_seconds" UnixTimestamp = "unix_timestamp" UTCDate = "utc_date" UTCTime = "utc_time" UTCTimestamp = "utc_timestamp" Week = "week" Weekday = "weekday" WeekOfYear = "weekofyear" Year = "year" YearWeek = "yearweek" LastDay = "last_day" // string functions ASCII = "ascii" Bin = "bin" Concat = "concat" ConcatWS = "concat_ws" Convert = "convert" Elt = "elt" ExportSet = "export_set" Field = "field" Format = "format" FromBase64 = "from_base64" InsertFunc = "insert_func" Instr = "instr" Lcase = "lcase" Left = "left" Length = "length" LoadFile = "load_file" Locate = "locate" Lower = "lower" Lpad = "lpad" LTrim = "ltrim" MakeSet = "make_set" Mid = "mid" Oct = "oct" OctetLength = "octet_length" Ord = "ord" Position = "position" Quote = "quote" Repeat = "repeat" Replace = "replace" Reverse = "reverse" Right = "right" RTrim = "rtrim" Space = "space" Strcmp = "strcmp" Substring = "substring" Substr = "substr" SubstringIndex = "substring_index" ToBase64 = "to_base64" Trim = "trim" Translate = "translate" Upper = "upper" Ucase = "ucase" Hex = "hex" Unhex = "unhex" Rpad = "rpad" BitLength = "bit_length" CharFunc = "char_func" CharLength = "char_length" CharacterLength = "character_length" FindInSet = "find_in_set" WeightString = "weight_string" Soundex = "soundex" // information functions Benchmark = "benchmark" Charset = "charset" Coercibility = "coercibility" Collation = "collation" ConnectionID = "connection_id" CurrentUser = "current_user" CurrentRole = "current_role" Database = "database" FoundRows = "found_rows" LastInsertId = "last_insert_id" RowCount = "row_count" Schema = "schema" SessionUser = "session_user" SystemUser = "system_user" User = "user" Version = "version" FormatBytes = "format_bytes" FormatNano = "format_nano_time" // control functions If = "if" Ifnull = "ifnull" Nullif = "nullif" // miscellaneous functions AnyValue = "any_value" DefaultFunc = "default_func" InetAton = "inet_aton" InetNtoa = "inet_ntoa" Inet6Aton = "inet6_aton" Inet6Ntoa = "inet6_ntoa" IsFreeLock = "is_free_lock" IsIPv4 = "is_ipv4" IsIPv4Compat = "is_ipv4_compat" IsIPv4Mapped = "is_ipv4_mapped" IsIPv6 = "is_ipv6" IsUsedLock = "is_used_lock" IsUUID = "is_uuid" NameConst = "name_const" ReleaseAllLocks = "release_all_locks" Sleep = "sleep" UUID = "uuid" UUIDShort = "uuid_short" UUIDToBin = "uuid_to_bin" BinToUUID = "bin_to_uuid" GetLock = "get_lock" ReleaseLock = "release_lock" Grouping = "grouping" // encryption and compression functions AesDecrypt = "aes_decrypt" AesEncrypt = "aes_encrypt" Compress = "compress" Decode = "decode" Encode = "encode" MD5 = "md5" PasswordFunc = "password" RandomBytes = "random_bytes" SHA1 = "sha1" SHA = "sha" SHA2 = "sha2" SM3 = "sm3" Uncompress = "uncompress" UncompressedLength = "uncompressed_length" ValidatePasswordStrength = "validate_password_strength" // json functions JSONType = "json_type" JSONExtract = "json_extract" JSONUnquote = "json_unquote" JSONArray = "json_array" JSONObject = "json_object" JSONMerge = "json_merge" JSONSet = "json_set" JSONInsert = "json_insert" JSONReplace = "json_replace" JSONRemove = "json_remove" JSONOverlaps = "json_overlaps" JSONContains = "json_contains" JSONMemberOf = "json_memberof" JSONContainsPath = "json_contains_path" JSONValid = "json_valid" JSONArrayAppend = "json_array_append" JSONArrayInsert = "json_array_insert" JSONMergePatch = "json_merge_patch" JSONMergePreserve = "json_merge_preserve" JSONPretty = "json_pretty" JSONQuote = "json_quote" JSONSchemaValid = "json_schema_valid" JSONSearch = "json_search" JSONStorageFree = "json_storage_free" JSONStorageSize = "json_storage_size" JSONDepth = "json_depth" JSONKeys = "json_keys" JSONLength = "json_length" // aggregate functions AggFuncCount = "count" AggFuncSum = "sum" AggFuncAvg = "avg" AggFuncFirstRow = "firstrow" AggFuncMax = "max" AggFuncMin = "min" AggFuncGroupConcat = "group_concat" AggFuncBitOr = "bit_or" AggFuncBitXor = "bit_xor" AggFuncBitAnd = "bit_and" AggFuncVarPop = "var_pop" AggFuncVarSamp = "var_samp" AggFuncStddevPop = "stddev_pop" AggFuncStddevSamp = "stddev_samp" AggFuncJsonArrayagg = "json_arrayagg" AggFuncJsonObjectAgg = "json_objectagg" AggFuncApproxCountDistinct = "approx_count_distinct" // window functions WindowFuncRowNumber = "row_number" WindowFuncRank = "rank" WindowFuncDenseRank = "dense_rank" WindowFuncCumeDist = "cume_dist" WindowFuncPercentRank = "percent_rank" WindowFuncNtile = "ntile" WindowFuncLead = "lead" WindowFuncLag = "lag" WindowFuncFirstValue = "first_value" WindowFuncLastValue = "last_value" WindowFuncNthValue = "nth_value" )
List scalar function names.
const ( KindNull byte = 0 KindInt64 byte = 1 KindUint64 byte = 2 KindFloat32 byte = 3 KindFloat64 byte = 4 KindString byte = 5 KindBytes byte = 6 KindBinaryLiteral byte = 7 KindMysqlDecimal byte = 8 KindMysqlDuration byte = 9 KindMysqlEnum byte = 10 KindMysqlBit byte = 11 KindMysqlSet byte = 12 KindMysqlTime byte = 13 KindInterface byte = 14 KindMinNotNull byte = 15 KindMaxValue byte = 16 KindRaw byte = 17 KindMysqlJSON byte = 18 )
Kind constants for Datum.
const ( TypeUnspecified byte = 0 TypeTiny byte = 1 TypeShort byte = 2 TypeLong byte = 3 TypeFloat byte = 4 TypeDouble byte = 5 TypeNull byte = 6 TypeTimestamp byte = 7 TypeLonglong byte = 8 TypeInt24 byte = 9 TypeDate byte = 10 TypeDuration byte = 11 TypeDatetime byte = 12 TypeYear byte = 13 TypeNewDate byte = 14 TypeVarchar byte = 15 TypeBit byte = 16 TypeJSON byte = 245 TypeNewDecimal byte = 246 TypeEnum byte = 247 TypeSet byte = 248 TypeTinyBlob byte = 249 TypeMediumBlob byte = 250 TypeLongBlob byte = 251 TypeBlob byte = 252 TypeVarString byte = 253 TypeString byte = 254 TypeGeometry byte = 255 )
MySQL type information.
const ( NotNullFlag uint = 1 << 0 PriKeyFlag uint = 1 << 1 UniqueKeyFlag uint = 1 << 2 MultipleKeyFlag uint = 1 << 3 BlobFlag uint = 1 << 4 UnsignedFlag uint = 1 << 5 ZerofillFlag uint = 1 << 6 BinaryFlag uint = 1 << 7 EnumFlag uint = 1 << 8 AutoIncrementFlag uint = 1 << 9 TimestampFlag uint = 1 << 10 SetFlag uint = 1 << 11 NoDefaultValueFlag uint = 1 << 12 OnUpdateNowFlag uint = 1 << 13 NumFlag uint = 1 << 14 PartKeyFlag uint = 1 << 15 GroupFlag uint = 1 << 16 UniqueFlag uint = 1 << 17 BinCmpFlag uint = 1 << 18 )
Flag information.
const SetCharsetVar = "SetCharset"
SetCharset is the const for set charset stmt.
const SetNames = "SetNAMES"
SetNames is the const for set names stmt.
Variables ¶
This section is empty.
Functions ¶
func ExtractColumnAndValue ¶
func ExtractColumnAndValue(expr *BinaryOperationExpr) (columnNameL string, value any, ok bool)
extractColumnAndValue extracts column name and comparison value from binary expression
func ExtractColumnNameL ¶
ExtractColumnNameL extracts column name from expression return lower case column name
func ExtractColumnSchemaTableNameL ¶
extractColumnTableAndName extracts both table and column name from expression
func ExtractValueFromExpr ¶
ExtractValueFromExpr extracts value from expression Returns the actual Go value (int64, uint64, float64, string, etc.), not the Datum wrapper
func IsNullValue ¶
IsNullValue checks if an expression is a NULL literal
func WalkExprColumnsReadOnly ¶
func WalkExprColumnsReadOnly(expr ExprNode, fn func(*ColumnName))
WalkExprColumnsReadOnly traverses an AST expression tree in deterministic source order and invokes fn for every non-nil ColumnName encountered. Unlike Node.Accept, it never mutates child pointers on shared AST nodes.
func WalkExprColumnsScopedReadOnly ¶
func WalkExprColumnsScopedReadOnly(expr ExprNode, fn func(col *ColumnName, inNestedQuery bool))
WalkExprColumnsScopedReadOnly traverses an AST expression tree without mutating AST pointers and invokes fn for every non-nil ColumnName, passing inNestedQuery=true once traversal enters a subquery, derived query, or CTE.
func WalkJoinColumnsReadOnly ¶
func WalkJoinColumnsReadOnly(node ResultSetNode, fn func(*ColumnName))
WalkJoinColumnsReadOnly traverses a FROM/JOIN result-set tree without mutating AST pointers and invokes fn for every ColumnName encountered in JOIN ON/USING clauses and nested derived queries.
func WalkJoinColumnsScopedReadOnly ¶
func WalkJoinColumnsScopedReadOnly(node ResultSetNode, fn func(col *ColumnName, inNestedQuery bool))
WalkJoinColumnsScopedReadOnly traverses a FROM/JOIN result-set tree without mutating AST pointers, reporting inNestedQuery=false for the current block's JOIN ON/USING clauses and inNestedQuery=true for nested derived queries.
func WalkResultSetColumnsReadOnly ¶
func WalkResultSetColumnsReadOnly(node ResultSetNode, fn func(*ColumnName))
WalkResultSetColumnsReadOnly traverses a SELECT or set-operation AST without mutating AST pointers and invokes fn for every ColumnName encountered.
Types ¶
type AdminStmt ¶
type AdminStmt struct {
Tp AdminStmtType
Index string
Tables []*TableName
JobIDs []int64
JobNumber int64
HandleRanges []HandleRange
ShowSlow *ShowSlow
Plugins []string
Where ExprNode
StatementScope StatementScope
// contains filtered or unexported fields
}
AdminStmt is the struct for Admin statement.
type AdminStmtType ¶
type AdminStmtType int
AdminStmtType is the type for admin statement.
const ( AdminShowDDL AdminStmtType = iota + 1 AdminCheckTable AdminShowDDLJobs AdminCancelDDLJobs AdminCheckIndex AdminRecoverIndex AdminCleanupIndex AdminCheckIndexRange AdminShowDDLJobQueries AdminShowDDLJobQueriesWithRange AdminChecksumTable AdminShowSlow AdminShowNextRowID AdminReloadExprPushdownBlacklist AdminReloadOptRuleBlacklist AdminPluginDisable AdminPluginEnable AdminFlushBindings AdminCaptureBindings AdminEvolveBindings AdminReloadBindings AdminShowTelemetry AdminResetTelemetryID AdminReloadStatistics AdminFlushPlanCache AdminSetBDRRole AdminUnsetBDRRole AdminShowBDRRole AdminPauseDDLJobs AdminResumeDDLJobs )
Admin statement types.
type AggregateFuncExpr ¶
type AggregateFuncExpr struct {
F string // function name
Args []ExprNode
Distinct bool
// contains filtered or unexported fields
}
AggregateFuncExpr represents an aggregate function expression
func NewAggregateFuncExpr ¶
func NewAggregateFuncExpr(f string, distinct bool, args ...ExprNode) *AggregateFuncExpr
NewAggregateFuncExpr creates a new AggregateFuncExpr
func (*AggregateFuncExpr) Accept ¶
func (afe *AggregateFuncExpr) Accept(visitor Visitor) (Node, bool)
Accept implements Node interface
func (*AggregateFuncExpr) GetFlag ¶
func (en *AggregateFuncExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*AggregateFuncExpr) GetType ¶
func (en *AggregateFuncExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*AggregateFuncExpr) GetValue ¶
func (en *AggregateFuncExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*AggregateFuncExpr) SetFlag ¶
func (en *AggregateFuncExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type AlgorithmType ¶
type AlgorithmType byte
AlgorithmType is the algorithm type for alter table.
const ( AlgorithmTypeDefault AlgorithmType = iota AlgorithmTypeCopy AlgorithmTypeInplace AlgorithmTypeInstant )
Algorithm types.
type AlterDatabaseStmt ¶
type AlterDatabaseStmt struct {
Name string
AlterDefaultDatabase bool
Options []*DatabaseOption
// contains filtered or unexported fields
}
AlterDatabaseStmt is a statement to change the database.
type AlterOrderItem ¶
type AlterOrderItem struct {
Column *ColumnName
Desc bool
// contains filtered or unexported fields
}
AlterOrderItem represents an item in "ORDER BY" for AlterTableSpec.
func (*AlterOrderItem) Accept ¶
func (n *AlterOrderItem) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*AlterOrderItem) OriginTextPosition ¶
func (n *AlterOrderItem) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*AlterOrderItem) OriginalText ¶
func (n *AlterOrderItem) OriginalText() string
OriginalText implements Node interface
func (*AlterOrderItem) SetOriginTextPosition ¶
func (n *AlterOrderItem) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type AlterTableSpec ¶
type AlterTableSpec struct {
// IfExists indicates IF EXISTS clause.
IfExists bool
// IfNotExists indicates IF NOT EXISTS clause.
IfNotExists bool
NoWriteToBinlog bool
OnAllPartitions bool
Tp AlterTableType
Name string
IndexName CIStr
Constraint *Constraint
Options []*TableOption
OrderByList []*AlterOrderItem
NewTable *TableName
NewColumns []*ColumnDef
NewConstraints []*Constraint
OldColumnName *ColumnName
NewColumnName *ColumnName
Position *ColumnPosition
LockType LockType
Algorithm AlgorithmType
Partition *PartitionOptions
PartitionNames []CIStr
Visibility IndexVisibility
// contains filtered or unexported fields
}
AlterTableSpec represents a single specification of an ALTER TABLE statement.
func (*AlterTableSpec) Accept ¶
func (n *AlterTableSpec) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*AlterTableSpec) OriginTextPosition ¶
func (n *AlterTableSpec) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*AlterTableSpec) OriginalText ¶
func (n *AlterTableSpec) OriginalText() string
OriginalText implements Node interface
func (*AlterTableSpec) SetOriginTextPosition ¶
func (n *AlterTableSpec) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type AlterTableStmt ¶
type AlterTableStmt struct {
Table *TableName
Specs []*AlterTableSpec
// contains filtered or unexported fields
}
AlterTableStmt is a statement to alter the table definition.
type AlterTableType ¶
type AlterTableType int
AlterTableType is the type for alter table specification.
const ( AlterTableOption AlterTableType = iota + 1 AlterTableAddColumns AlterTableAddConstraint AlterTableDropColumn AlterTableDropPrimaryKey AlterTableDropIndex AlterTableDropForeignKey AlterTableModifyColumn AlterTableChangeColumn AlterTableRenameColumn AlterTableRenameTable AlterTableAlterColumn AlterTableLock AlterTableWriteable AlterTableAlgorithm AlterTableRenameIndex AlterTableForce AlterTableAddPartitions AlterTableCoalescePartitions AlterTableDropPartition AlterTableTruncatePartition AlterTablePartition AlterTableEnableKeys AlterTableDisableKeys AlterTableRemovePartitioning AlterTableWithValidation AlterTableWithoutValidation AlterTableSecondaryLoad AlterTableSecondaryUnload AlterTableRebuildPartition AlterTableReorganizePartition AlterTableCheckPartitions AlterTableExchangePartition AlterTableOptimizePartition AlterTableRepairPartition AlterTableImportPartitionTablespace AlterTableDiscardPartitionTablespace AlterTableAlterCheck AlterTableDropCheck AlterTableImportTablespace AlterTableDiscardTablespace AlterTableIndexInvisible AlterTableOrderByColumns AlterTableSetTiFlashReplica AlterTableAddStatistics AlterTableDropStatistics AlterTableAttributes AlterTablePartitionAttributes AlterTablePartitionOptions AlterTableCache AlterTableNoCache AlterTableStatsOptions AlterTableDropFirstPartition AlterTableAddLastPartition AlterTableReorganizeFirstPartition AlterTableReorganizeLastPartition AlterTableRemoveTTL AlterTablePlacement )
Alter table specification types.
type AnalyzeTableStmt ¶
type AnalyzeTableStmt struct {
TableNames []*TableName
PartitionNames []CIStr
IndexNames []CIStr
MaxNumBuckets uint64
// IndexFlag is true when we only analyze indices for a table.
IndexFlag bool
// Incremental is true when we want to add index statistics based on the prevision statistics.
Incremental bool
// HistogramOperation is the operation of histogram statistics.
HistogramOperation HistogramOperation
// ColumnNames indicates the columns to analyze.
ColumnNames []*ColumnName
// ColumnChoice indicates the columns to analyze, can be all/predicate/list.
ColumnChoice ColumnChoice
// contains filtered or unexported fields
}
AnalyzeTableStmt is used to create table statistics.
type AsOfClause ¶
type AsOfClause struct {
TsExpr ExprNode
// contains filtered or unexported fields
}
AsOfClause represents the AS OF TIMESTAMP clause.
func (*AsOfClause) Accept ¶
func (n *AsOfClause) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*AsOfClause) OriginTextPosition ¶
func (n *AsOfClause) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*AsOfClause) OriginalText ¶
func (n *AsOfClause) OriginalText() string
OriginalText implements Node interface
func (*AsOfClause) SetOriginTextPosition ¶
func (n *AsOfClause) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type Assignment ¶
type Assignment struct {
// Column is the column to be updated.
Column *ColumnName
// Expr is the value expression to update the column to.
Expr ExprNode
// contains filtered or unexported fields
}
Assignment represents a column/value pair in UPDATE statement.
func (*Assignment) Accept ¶
func (n *Assignment) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*Assignment) OriginTextPosition ¶
func (n *Assignment) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*Assignment) OriginalText ¶
func (n *Assignment) OriginalText() string
OriginalText implements Node interface
func (*Assignment) SetOriginTextPosition ¶
func (n *Assignment) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type AuthOption ¶
AuthOption is used for auth option.
type BeginStmt ¶
type BeginStmt struct {
// Mode is the transaction mode.
Mode string
// ReadOnly is true if "START TRANSACTION READ ONLY" is used.
ReadOnly bool
// AsOf is used in "START TRANSACTION ... AS OF TIMESTAMP".
AsOf *AsOfClause
// CausalConsistencyOnly is true if "START TRANSACTION WITH CAUSAL CONSISTENCY ONLY" is used.
CausalConsistencyOnly bool
// contains filtered or unexported fields
}
BeginStmt is a statement to start a new transaction.
type BetweenExpr ¶
type BetweenExpr struct {
Expr ExprNode
Left ExprNode
Right ExprNode
Not bool
// contains filtered or unexported fields
}
BetweenExpr represents a BETWEEN expression
func NewBetweenExpr ¶
func NewBetweenExpr(expr, left, right ExprNode, not bool) *BetweenExpr
NewBetweenExpr creates a new BetweenExpr
func (*BetweenExpr) Accept ¶
func (be *BetweenExpr) Accept(visitor Visitor) (Node, bool)
Accept implements Node interface
func (*BetweenExpr) GetFlag ¶
func (en *BetweenExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*BetweenExpr) GetType ¶
func (en *BetweenExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*BetweenExpr) GetValue ¶
func (en *BetweenExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*BetweenExpr) SetFlag ¶
func (en *BetweenExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type BinaryOperationExpr ¶
type BinaryOperationExpr struct {
// Op is the operator opcode.
Op Op
// L is the left expression in BinaryOperation.
L ExprNode
// R is the right expression in BinaryOperation.
R ExprNode
// contains filtered or unexported fields
}
BinaryOperationExpr is for binary operation like `1 + 1`, `1 - 1`, etc.
func NewBinaryOperation ¶
func NewBinaryOperation(op Op, l, r ExprNode) *BinaryOperationExpr
NewBinaryOperation creates a new BinaryOperationExpr
func (*BinaryOperationExpr) Accept ¶
func (boe *BinaryOperationExpr) Accept(visitor Visitor) (Node, bool)
Accept implements Node interface
func (*BinaryOperationExpr) GetFlag ¶
func (en *BinaryOperationExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*BinaryOperationExpr) GetType ¶
func (en *BinaryOperationExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*BinaryOperationExpr) GetValue ¶
func (en *BinaryOperationExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*BinaryOperationExpr) SetFlag ¶
func (en *BinaryOperationExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type ByItem ¶
type ByItem struct {
Expr ExprNode
Desc bool
NullOrder bool
// contains filtered or unexported fields
}
ByItem represents an item in order by or group by.
func (*ByItem) OriginTextPosition ¶
func (n *ByItem) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*ByItem) OriginalText ¶
func (n *ByItem) OriginalText() string
OriginalText implements Node interface
func (*ByItem) SetOriginTextPosition ¶
func (n *ByItem) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type CallStmt ¶
type CallStmt struct {
Procedure *TableName
Args []ExprNode
// contains filtered or unexported fields
}
CallStmt represents a CALL statement.
type CaseExpr ¶
type CaseExpr struct {
Value ExprNode
WhenClauses []*WhenClause
ElseClause ExprNode
// contains filtered or unexported fields
}
CaseExpr represents a CASE expression
func NewCaseExpr ¶
func NewCaseExpr(value ExprNode, whenClauses []*WhenClause, elseClause ExprNode) *CaseExpr
NewCaseExpr creates a new CaseExpr
func (*CaseExpr) GetFlag ¶
func (en *CaseExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*CaseExpr) GetType ¶
func (en *CaseExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*CaseExpr) GetValue ¶
func (en *CaseExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*CaseExpr) SetFlag ¶
func (en *CaseExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type CastFunctionType ¶
type CastFunctionType int
CastFunctionType is the type for CAST/CONVERT/BINARY functions.
const ( CastFunction CastFunctionType = iota + 1 CastConvertFunction CastBinaryOperator )
CastFunction types
type ColumnChoice ¶
type ColumnChoice int
ColumnChoice is used in ANALYZE TABLE statement.
const ( DefaultChoice ColumnChoice = iota AllColumns PredicateColumns ColumnList )
ColumnChoice types.
type ColumnDef ¶
type ColumnDef struct {
Name *ColumnName
Tp *FieldType
Options []*ColumnOption
// contains filtered or unexported fields
}
ColumnDef is column definition.
func (*ColumnDef) OriginTextPosition ¶
func (n *ColumnDef) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*ColumnDef) OriginalText ¶
func (n *ColumnDef) OriginalText() string
OriginalText implements Node interface
func (*ColumnDef) SetOriginTextPosition ¶
func (n *ColumnDef) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type ColumnName ¶
type ColumnName struct {
// ========== Original names (as written in SQL, corresponding to MySQL's m_orig_*) ==========
Schema CIStr // m_orig_db_name
Table CIStr // m_orig_table_name
Name CIStr // m_orig_field_name
// ========== Resolved names (after fix_fields, corresponding to MySQL's db_name/table_name/field_name) ==========
ResolvedSchema CIStr // Resolved schema name
ResolvedTable CIStr // Resolved actual table name (after resolving table alias)
ResolvedName CIStr // Resolved actual column name (after resolving column alias)
// ========== Resolution state (corresponding to MySQL's various flags) ==========
// AliasOfExpr corresponds to MySQL's m_alias_of_expr
// True if this column name is an alias reference to a SELECT expression
AliasOfExpr bool
// CachedTableRef corresponds to MySQL's Item_ident::cached_table
// Points to the resolved TableSource after fix_fields
CachedTableRef *TableSource
// RefItem corresponds to MySQL's Item_ref::m_ref_item
// For derived tables/views, points to the underlying expression
// Used to trace back to the base table through multiple layers
RefItem ExprNode
// Fixed corresponds to MySQL's Item::fixed
// Indicates whether fix_fields has been called
Fixed bool
// contains filtered or unexported fields
}
ColumnName represents column name with alias resolution support. Mirrors MySQL's Item_ident which maintains both original and resolved names.
MySQL's Item_ident structure:
- m_orig_db_name, m_orig_table_name, m_orig_field_name: original names (as written in SQL)
- db_name, table_name, field_name: resolved names (after alias resolution)
- cached_table: cached reference to the resolved table
In our implementation:
- Schema, Table, Name: original names (as written in SQL, corresponding to m_orig_*)
- Resolved*: resolved names (after fix_fields, corresponding to db_name/table_name/field_name)
func ConvertColumnName ¶
func ConvertColumnName(col *ast.ColumnName) *ColumnName
ConvertColumnName converts a TiDB ColumnName to a custom parser ColumnName
func ExtractColumn ¶
func ExtractColumn(expr ExprNode) *ColumnName
func NewColumnName ¶
func NewColumnName(schema, table, name string) *ColumnName
NewColumnName creates a new ColumnName
func (*ColumnName) Accept ¶
func (n *ColumnName) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*ColumnName) ActualName ¶
func (n *ColumnName) ActualName() CIStr
ActualName returns the actual column name (resolved if available, otherwise original).
func (*ColumnName) ActualSchema ¶
func (n *ColumnName) ActualSchema() CIStr
ActualSchema returns the actual schema name (resolved if available, otherwise original).
func (*ColumnName) ActualTable ¶
func (n *ColumnName) ActualTable() CIStr
ActualTable returns the actual table name (resolved if available, otherwise original).
func (*ColumnName) GetBaseTableInfo ¶
func (n *ColumnName) GetBaseTableInfo() (schema, table, column CIStr)
GetBaseTableInfo returns the base table information by tracing through all references. Returns (schema, table, column) of the underlying base table.
func (*ColumnName) GetColumnNameL ¶
func (n *ColumnName) GetColumnNameL() string
func (*ColumnName) GetColumnNameO ¶
func (n *ColumnName) GetColumnNameO() string
func (*ColumnName) GetOriginalTableNameL ¶
func (n *ColumnName) GetOriginalTableNameL() string
func (*ColumnName) GetRealColumnNameL ¶
func (n *ColumnName) GetRealColumnNameL() string
func (*ColumnName) GetResolvedPhysicalTableNameL ¶
func (n *ColumnName) GetResolvedPhysicalTableNameL() string
func (*ColumnName) GetTableNameL ¶
func (n *ColumnName) GetTableNameL() string
func (*ColumnName) Match ¶
func (n *ColumnName) Match(b *ColumnName) bool
Match means that if a match b, e.g. t.a can match test.t.a but test.t.a can't match t.a.
func (*ColumnName) OrigColName ¶
func (n *ColumnName) OrigColName() (ret string)
OrigColName returns the full original column name.
func (*ColumnName) OriginTextPosition ¶
func (n *ColumnName) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*ColumnName) OriginalName ¶
func (n *ColumnName) OriginalName() CIStr
OriginalName returns the original column name (as written in SQL). Corresponds to MySQL's Item_ident::original_field_name().
func (*ColumnName) OriginalSchema ¶
func (n *ColumnName) OriginalSchema() CIStr
OriginalSchema returns the original schema name (as written in SQL). Corresponds to MySQL's Item_ident::original_db_name().
func (*ColumnName) OriginalTable ¶
func (n *ColumnName) OriginalTable() CIStr
OriginalTable returns the original table name (as written in SQL). Corresponds to MySQL's Item_ident::original_table_name().
func (*ColumnName) OriginalText ¶
func (n *ColumnName) OriginalText() string
OriginalText implements Node interface
func (*ColumnName) RealItem ¶
func (n *ColumnName) RealItem() *ColumnName
RealItem returns the underlying item, tracing through view/derived table references. Corresponds to MySQL's Item_ref::real_item(). For multi-layer derived tables, this iteratively finds the base Item_field while guarding against cyclic RefItem chains.
func (*ColumnName) SetOriginTextPosition ¶
func (n *ColumnName) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
func (*ColumnName) SetText ¶
func (n *ColumnName) SetText(text string)
SetText implements Node interface
func (*ColumnName) String ¶
func (n *ColumnName) String() string
String implements Stringer interface.
type ColumnNameExpr ¶
type ColumnNameExpr struct {
// Name is the referenced column name.
Name *ColumnName
// Context is the name resolution context for this expression.
// Corresponds to MySQL's Item_ident::context.
Context *NameResolutionContext
// DependedFrom indicates the query block this reference depends on.
// Used for correlated subqueries (outer references).
// Corresponds to MySQL's Item_ident::depended_from.
DependedFrom *SelectStmt
// contains filtered or unexported fields
}
ColumnNameExpr represents a column name expression. Corresponds to MySQL's Item_field.
func NewColumnNameExpr ¶
func NewColumnNameExpr(name *ColumnName) *ColumnNameExpr
NewColumnNameExpr creates a new ColumnNameExpr
func (*ColumnNameExpr) Accept ¶
func (n *ColumnNameExpr) Accept(v Visitor) (Node, bool)
Accept implements Node interface
func (*ColumnNameExpr) GetFlag ¶
func (en *ColumnNameExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*ColumnNameExpr) GetType ¶
func (en *ColumnNameExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*ColumnNameExpr) GetValue ¶
func (en *ColumnNameExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*ColumnNameExpr) SetFlag ¶
func (en *ColumnNameExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type ColumnOption ¶
type ColumnOption struct {
Tp ColumnOptionType
// Expr is used for ColumnOptionDefaultValue/ColumnOptionOnUpdate/ColumnOptionGenerated.
Expr ExprNode
// Stored is only for ColumnOptionGenerated, default is false.
Stored bool
// Refer is used for foreign key.
Refer *ReferenceDef
// StrValue is string value for comment, collate, etc.
StrValue string
// Enforced is only for Check, default is true.
Enforced bool
// ConstraintName is only used for Check Constraint name.
ConstraintName string
// contains filtered or unexported fields
}
ColumnOption is used for column option.
func (*ColumnOption) Accept ¶
func (n *ColumnOption) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*ColumnOption) OriginTextPosition ¶
func (n *ColumnOption) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*ColumnOption) OriginalText ¶
func (n *ColumnOption) OriginalText() string
OriginalText implements Node interface
func (*ColumnOption) SetOriginTextPosition ¶
func (n *ColumnOption) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type ColumnOptionType ¶
type ColumnOptionType int
ColumnOptionType is the type for column option type.
const ( ColumnOptionNoOption ColumnOptionType = iota ColumnOptionPrimaryKey ColumnOptionNotNull ColumnOptionAutoIncrement ColumnOptionDefaultValue ColumnOptionUniqKey ColumnOptionKey ColumnOptionNull ColumnOptionOnUpdate ColumnOptionFulltext ColumnOptionComment ColumnOptionGenerated ColumnOptionReference ColumnOptionCollate ColumnOptionCheck ColumnOptionColumnFormat ColumnOptionStorage ColumnOptionAutoRandom )
Column option types.
type ColumnPosition ¶
type ColumnPosition struct {
// Tp is either ColumnPositionFirst or ColumnPositionAfter.
Tp ColumnPositionType
// RelativeColumn is the column the newly added column is positioned relative to.
RelativeColumn *ColumnName
// contains filtered or unexported fields
}
ColumnPosition is the position of a column in a table.
func (*ColumnPosition) Accept ¶
func (n *ColumnPosition) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*ColumnPosition) OriginTextPosition ¶
func (n *ColumnPosition) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*ColumnPosition) OriginalText ¶
func (n *ColumnPosition) OriginalText() string
OriginalText implements Node interface
func (*ColumnPosition) SetOriginTextPosition ¶
func (n *ColumnPosition) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type ColumnPositionType ¶
type ColumnPositionType int
ColumnPositionType is the type for column position.
const ( ColumnPositionNone ColumnPositionType = iota ColumnPositionFirst ColumnPositionAfter )
Column position types.
type CommitStmt ¶
type CommitStmt struct {
// CompletionType indicates the completion type.
CompletionType CompletionType
// contains filtered or unexported fields
}
CommitStmt is a statement to commit the current transaction.
type CommonTableExpression ¶
type CommonTableExpression struct {
Name CIStr
Query *SubqueryExpr
ColNameList []CIStr
IsRecursive bool
// contains filtered or unexported fields
}
CommonTableExpression represents CTE.
func (*CommonTableExpression) Accept ¶
func (n *CommonTableExpression) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*CommonTableExpression) OriginTextPosition ¶
func (n *CommonTableExpression) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*CommonTableExpression) OriginalText ¶
func (n *CommonTableExpression) OriginalText() string
OriginalText implements Node interface
func (*CommonTableExpression) SetOriginTextPosition ¶
func (n *CommonTableExpression) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type CompareSubqueryExpr ¶
type CompareSubqueryExpr struct {
// L is the left expression.
L ExprNode
// Op is the comparison opcode.
Op Op
// R is the subquery for right expression, may be rewritten to other type of expression.
R ExprNode
// All is true, we should compare all records in subquery.
All bool
// contains filtered or unexported fields
}
CompareSubqueryExpr is the expression for "expr cmp (select ...)". See https://dev.mysql.com/doc/refman/5.7/en/comparisons-using-subqueries.html See https://dev.mysql.com/doc/refman/5.7/en/any-in-some-subqueries.html See https://dev.mysql.com/doc/refman/5.7/en/all-subqueries.html
func NewCompareSubqueryExpr ¶
func NewCompareSubqueryExpr(l ExprNode, op Op, r ExprNode, all bool) *CompareSubqueryExpr
NewCompareSubqueryExpr creates a new CompareSubqueryExpr
func (*CompareSubqueryExpr) Accept ¶
func (n *CompareSubqueryExpr) Accept(v Visitor) (Node, bool)
Accept implements Node interface
func (*CompareSubqueryExpr) GetFlag ¶
func (en *CompareSubqueryExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*CompareSubqueryExpr) GetType ¶
func (en *CompareSubqueryExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*CompareSubqueryExpr) GetValue ¶
func (en *CompareSubqueryExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*CompareSubqueryExpr) SetFlag ¶
func (en *CompareSubqueryExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type CompletionType ¶
type CompletionType int
CompletionType is the type for completion type.
const ( CompletionTypeDefault CompletionType = iota CompletionTypeChain CompletionTypeRelease )
Completion types.
type Constraint ¶
type Constraint struct {
// IfNotExists indicates IF NOT EXISTS clause.
IfNotExists bool
Tp ConstraintType
Name string
Keys []*IndexPartSpecification // Used for PRIMARY KEY, UNIQUE, ......
Refer *ReferenceDef // Used for foreign key.
Option *IndexOption // Index Options
Expr ExprNode // Used for Check
Enforced bool // Used for Check
InColumn bool // Used for Check
InColumnName string // Used for Check
IsEmptyIndex bool // Used for Check
// contains filtered or unexported fields
}
Constraint is constraint for table definition.
func (*Constraint) Accept ¶
func (n *Constraint) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*Constraint) OriginTextPosition ¶
func (n *Constraint) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*Constraint) OriginalText ¶
func (n *Constraint) OriginalText() string
OriginalText implements Node interface
func (*Constraint) SetOriginTextPosition ¶
func (n *Constraint) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type ConstraintType ¶
type ConstraintType int
ConstraintType is the type for constraint.
const ( ConstraintNoConstraint ConstraintType = iota ConstraintPrimaryKey ConstraintKey ConstraintIndex ConstraintUniq ConstraintUniqKey ConstraintUniqIndex ConstraintForeignKey ConstraintFulltext ConstraintCheck ConstraintVector ConstraintColumnar )
Constraint types.
type CreateDatabaseStmt ¶
type CreateDatabaseStmt struct {
IfNotExists bool
Name string
Options []*DatabaseOption
// contains filtered or unexported fields
}
CreateDatabaseStmt is a statement to create a database.
type CreateIndexStmt ¶
type CreateIndexStmt struct {
IndexName string
Table *TableName
IndexPartSpecList []*IndexPartSpecification
IndexOption *IndexOption
KeyType IndexKeyType
LockAlg *IndexLockAndAlgorithm
IfNotExists bool
// contains filtered or unexported fields
}
CreateIndexStmt is a statement to create an index.
type CreateTableStmt ¶
type CreateTableStmt struct {
IfNotExists bool
TemporaryKeyword TemporaryKeyword
// OnCommitDelete is only for global temp table.
OnCommitDelete bool
Table *TableName
ReferTable *TableName
Cols []*ColumnDef
Constraints []*Constraint
Options []*TableOption
Partition *PartitionOptions
OnDuplicate OnDuplicateKeyHandlingType
Select ResultSetNode
// contains filtered or unexported fields
}
CreateTableStmt is a statement to create a table.
type CreateViewStmt ¶
type CreateViewStmt struct {
OrReplace bool
ViewName *TableName
Cols []CIStr
Select StmtNode
SchemaCols []CIStr
Algorithm ViewAlgorithm
Definer *UserSpec
Security ViewSecurity
CheckOption ViewCheckOption
// contains filtered or unexported fields
}
CreateViewStmt is a statement to create a view.
type DDLNode ¶
type DDLNode interface {
StmtNode
// contains filtered or unexported methods
}
DDLNode represents DDL statement node.
type DMLNode ¶
type DMLNode interface {
StmtNode
// contains filtered or unexported methods
}
DMLNode represents DML statement node.
type DatabaseOption ¶
type DatabaseOption struct {
Tp DatabaseOptionType
Value string
}
DatabaseOption represents database option.
type DatabaseOptionType ¶
type DatabaseOptionType int
DatabaseOptionType is the type for database option.
const ( DatabaseOptionNone DatabaseOptionType = iota DatabaseOptionCharset DatabaseOptionCollate DatabaseOptionEncryption DatabaseOptionPlacementPolicy )
Database option types.
type DateArithType ¶
type DateArithType int
DateArithType is the type for date arithmetic operations.
const ( DateArithAdd DateArithType = iota + 1 DateArithSub )
DateArith constants.
type Datum ¶
type Datum struct {
// contains filtered or unexported fields
}
Datum is a data box holds a basic value in SQL. Similar to TiDB's types.Datum.
func (*Datum) GetInterface ¶
GetInterface gets interface{} value.
func (*Datum) SetBytesAsString ¶
SetBytesAsString sets []byte value but kind as string.
func (*Datum) SetInterface ¶
SetInterface sets interface{} value.
type DefaultExpr ¶
type DefaultExpr struct {
// Name is the column name.
Name *ColumnName
// contains filtered or unexported fields
}
DefaultExpr is the default expression using default value for a column.
func NewDefaultExpr ¶
func NewDefaultExpr(name *ColumnName) *DefaultExpr
NewDefaultExpr creates a new DefaultExpr
func (*DefaultExpr) Accept ¶
func (n *DefaultExpr) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*DefaultExpr) GetFlag ¶
func (en *DefaultExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*DefaultExpr) GetType ¶
func (en *DefaultExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*DefaultExpr) GetValue ¶
func (en *DefaultExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*DefaultExpr) SetFlag ¶
func (en *DefaultExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type DeleteStmt ¶
type DeleteStmt struct {
// TableRefs is used in both single-table and multi-table delete statement.
TableRefs *TableRefsClause
// Tables is the list of tables to be deleted from.
Tables *DeleteTableList
// Where is the where clause.
Where ExprNode
// Order is the order by clause.
Order *OrderByClause
// Limit is the limit clause.
Limit *Limit
// LowPriority indicates low priority.
LowPriority bool
// Quick indicates QUICK modifier.
Quick bool
// IgnoreErr indicates ignore errors.
IgnoreErr bool
// IsMultiTable indicates if this is a multi-table delete statement.
IsMultiTable bool
// BeforeFrom indicates whether TABLES list is before FROM keyword.
BeforeFrom bool
// PartitionNames is the partition names.
PartitionNames []CIStr
// With is the with clause.
With *WithClause
// contains filtered or unexported fields
}
DeleteStmt is a statement to delete rows from table.
type DeleteTableList ¶
type DeleteTableList struct {
Tables []*TableName
// contains filtered or unexported fields
}
DeleteTableList is the tablelist used in delete statement multi-table mode.
func (*DeleteTableList) Accept ¶
func (n *DeleteTableList) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*DeleteTableList) OriginTextPosition ¶
func (n *DeleteTableList) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*DeleteTableList) OriginalText ¶
func (n *DeleteTableList) OriginalText() string
OriginalText implements Node interface
func (*DeleteTableList) SetOriginTextPosition ¶
func (n *DeleteTableList) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type DoStmt ¶
type DoStmt struct {
Exprs []ExprNode
// contains filtered or unexported fields
}
DoStmt is the struct for DO statement.
type DropDatabaseStmt ¶
type DropDatabaseStmt struct {
IfExists bool
Name string
// contains filtered or unexported fields
}
DropDatabaseStmt is a statement to drop a database.
type DropIndexStmt ¶
type DropIndexStmt struct {
IfExists bool
IndexName string
Table *TableName
LockAlg *IndexLockAndAlgorithm
// contains filtered or unexported fields
}
DropIndexStmt is a statement to drop an index.
type DropTableStmt ¶
type DropTableStmt struct {
IfExists bool
Tables []*TableName
IsView bool
TemporaryKeyword TemporaryKeyword
// contains filtered or unexported fields
}
DropTableStmt is a statement to drop a table.
type ExistsSubqueryExpr ¶
type ExistsSubqueryExpr struct {
// Sel is the subquery, may be rewritten to other type of expression.
Sel ExprNode
// Not is true, the expression is "not exists".
Not bool
// contains filtered or unexported fields
}
ExistsSubqueryExpr is the expression for "exists (select ...)". See https://dev.mysql.com/doc/refman/5.7/en/exists-and-not-exists-subqueries.html
func NewExistsSubqueryExpr ¶
func NewExistsSubqueryExpr(sel ExprNode, not bool) *ExistsSubqueryExpr
NewExistsSubqueryExpr creates a new ExistsSubqueryExpr
func (*ExistsSubqueryExpr) Accept ¶
func (n *ExistsSubqueryExpr) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*ExistsSubqueryExpr) GetFlag ¶
func (en *ExistsSubqueryExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*ExistsSubqueryExpr) GetType ¶
func (en *ExistsSubqueryExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*ExistsSubqueryExpr) GetValue ¶
func (en *ExistsSubqueryExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*ExistsSubqueryExpr) SetFlag ¶
func (en *ExistsSubqueryExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type ExplainFormatType ¶
type ExplainFormatType int
ExplainFormatType is the type for explain format.
const ( ExplainFormatDefault ExplainFormatType = iota ExplainFormatTraditional ExplainFormatJSON ExplainFormatTree ExplainFormatROW ExplainFormatBrief ExplainFormatDOT ExplainFormatTiDBJSON ExplainFormatCostTrace ExplainFormatPlanCache ExplainFormatBinary ExplainFormatVerbose ExplainFormatTrueCardCost )
Explain format types.
type ExplainStmt ¶
type ExplainStmt struct {
Stmt StmtNode
Format ExplainFormatType
Analyze bool
// contains filtered or unexported fields
}
ExplainStmt is a statement to explain.
type ExprNode ¶
type ExprNode interface {
Node
// SetType sets evaluation type to the expression.
SetType(tp *FieldType)
// GetType gets the evaluation type of the expression.
GetType() *FieldType
// SetFlag sets flag to the expression.
SetFlag(flag uint64)
// GetFlag returns the flag of the expression.
GetFlag() uint64
// SetValue sets value to expression node
SetValue(val interface{})
// GetValue gets value from expression node
GetValue() interface{}
// Format formats the AST into a writer.
Format(w io.Writer)
}
ExprNode is a node that can be evaluated. Name of implementations should have 'Expr' suffix.
func ConvertTiDBExprToCustom ¶
ConvertTiDBExprToCustom converts a TiDB expression to a custom expression
type FieldList ¶
type FieldList struct {
Fields []*SelectField
// contains filtered or unexported fields
}
FieldList represents field list in select statement.
func (*FieldList) OriginTextPosition ¶
func (n *FieldList) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*FieldList) OriginalText ¶
func (n *FieldList) OriginalText() string
OriginalText implements Node interface
func (*FieldList) SetOriginTextPosition ¶
func (n *FieldList) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type FieldResolver ¶
type FieldResolver struct {
// Context is the current name resolution context.
Context *NameResolutionContext
// QueryType indicates which part of the query is being resolved.
QueryType QueryContextType
// LowerCase indicates if names should be compared case-insensitively.
// Default is true (MySQL default behavior).
LowerCase bool
ColumnProvider TableInfoProvider
}
FieldResolver handles field resolution similar to MySQL's fix_fields mechanism. This corresponds to MySQL's field resolution logic in sql/item.cc and sql/sql_base.cc.
MySQL's resolution process:
- Item_field::fix_fields() is called
- find_field_in_tables() searches tables in the FROM clause
- If not found and is_item_list_lookup is true, search in SELECT list for column aliases
- If not found and there's an outer_context, search in outer queries (fix_outer_field)
func NewFieldResolver ¶
func NewFieldResolver(ctx *NameResolutionContext) *FieldResolver
NewFieldResolver creates a new field resolver.
func NewFieldResolverWithProvider ¶
func NewFieldResolverWithProvider(ctx *NameResolutionContext, provider TableInfoProvider) *FieldResolver
NewFieldResolverWithProvider creates a new field resolver with a column provider.
func (*FieldResolver) ExpandWildcards ¶
func (r *FieldResolver) ExpandWildcards(stmt *SelectStmt) *ResolvedFieldList
ExpandWildcards expands all wildcard (*) fields in a SELECT statement's field list. This creates a ResolvedFieldList with all columns expanded. Processing order:
- First resolve subqueries from innermost to outermost (already done by ResolveStmt)
- Then expand wildcards using column information from resolved tables
For derived tables (subqueries in FROM), columns come from FieldTranslation. For base tables, columns come from the ColumnProvider.
func (*FieldResolver) FixFields ¶
func (r *FieldResolver) FixFields(col *ColumnName) bool
FixFields resolves a column name expression. Corresponds to MySQL's Item_field::fix_fields() (sql/item.cc:5715).
Resolution order (following MySQL):
- For unqualified columns in ORDER BY/GROUP BY/HAVING, check SELECT aliases first
- Search in FROM clause tables (find_field_in_tables)
- If not found and SELECT list lookup is enabled, search for column aliases
- If not found and there's an outer context, search in outer queries
func (*FieldResolver) ResolveAndExpandStmt ¶
func (r *FieldResolver) ResolveAndExpandStmt(stmt *SelectStmt) *ResolvedFieldList
ResolveAndExpandStmt resolves all column references and expands wildcards. This is a convenience method that combines ResolveStmt and ExpandWildcards. It processes from innermost subqueries outward, then expands wildcards.
func (*FieldResolver) ResolveStmt ¶
func (r *FieldResolver) ResolveStmt(stmt *SelectStmt)
ResolveStmt resolves all column references in a statement. This sets up the resolution context and traverses the AST.
type FieldTranslator ¶
type FieldTranslator struct {
// Name is the column name (may be alias).
Name CIStr
// Item is the underlying expression.
Item ExprNode
}
FieldTranslator stores the mapping from derived table column to underlying expression. Corresponds to MySQL's Field_translator structure.
type FieldType ¶
type FieldType struct {
Tp byte
Flag uint
Flen int
Decimal int
Charset string
Collate string
Elems []string
}
FieldType represents field type information.
type FlushStmt ¶
type FlushStmt struct {
Tp FlushStmtType
NoWriteToBinLog bool
LogType LogType
Tables []*TableName
ReadLock bool
// contains filtered or unexported fields
}
FlushStmt is a statement to flush tables/privileges/status.
type FlushStmtType ¶
type FlushStmtType int
FlushStmtType is the type for flush statement.
const ( FlushNone FlushStmtType = iota FlushTables FlushPrivileges FlushStatus FlushLogs FlushTableWithReadLock FlushHosts FlushClientErrorsSummary )
Flush statement types.
type FrameBound ¶
type FrameBound struct {
Type BoundType
UnBounded bool
Expr ExprNode
// Unit is used to indicate the units in which the Expr should be interpreted.
Unit TimeUnitType
// contains filtered or unexported fields
}
FrameBound represents frame bound.
func (*FrameBound) Accept ¶
func (n *FrameBound) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*FrameBound) OriginTextPosition ¶
func (n *FrameBound) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*FrameBound) OriginalText ¶
func (n *FrameBound) OriginalText() string
OriginalText implements Node interface
func (*FrameBound) SetOriginTextPosition ¶
func (n *FrameBound) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type FrameClause ¶
type FrameClause struct {
Type FrameType
Extent FrameExtent
// contains filtered or unexported fields
}
FrameClause represents frame clause.
func (*FrameClause) Accept ¶
func (n *FrameClause) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*FrameClause) OriginTextPosition ¶
func (n *FrameClause) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*FrameClause) OriginalText ¶
func (n *FrameClause) OriginalText() string
OriginalText implements Node interface
func (*FrameClause) SetOriginTextPosition ¶
func (n *FrameClause) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type FrameExtent ¶
type FrameExtent struct {
Start FrameBound
End FrameBound
}
FrameExtent represents frame extent.
type FulltextSearchModifier ¶
type FulltextSearchModifier int
FulltextSearchModifier is the type for fulltext search modifier.
const ( FulltextSearchModifierNaturalLanguageMode FulltextSearchModifier = iota FulltextSearchModifierBooleanMode FulltextSearchModifierNaturalLanguageModeWithQueryExpansion FulltextSearchModifierWithQueryExpansion )
FulltextSearchModifier constants.
func (FulltextSearchModifier) IsBooleanMode ¶
func (m FulltextSearchModifier) IsBooleanMode() bool
IsBooleanMode returns true if the modifier is boolean mode.
func (FulltextSearchModifier) WithQueryExpansion ¶
func (m FulltextSearchModifier) WithQueryExpansion() bool
WithQueryExpansion returns true if the modifier contains query expansion.
type FuncCallExpr ¶
type FuncCallExpr struct {
Tp FuncCallExprType
Schema CIStr
// FnName is the function name.
FnName CIStr
// Args is the function args.
Args []ExprNode
// contains filtered or unexported fields
}
FuncCallExpr is for function expression.
func NewFuncCallExpr ¶
func NewFuncCallExpr(name string, args ...ExprNode) *FuncCallExpr
NewFuncCallExpr creates a new FuncCallExpr
type FuncCallExprType ¶
type FuncCallExprType int8
FuncCallExprType is the type for function call expression.
const ( // FuncCallExprTypeKeyword is keyword function. FuncCallExprTypeKeyword FuncCallExprType = iota // FuncCallExprTypeGeneric is generic function. FuncCallExprTypeGeneric )
type FuncCastExpr ¶
type FuncCastExpr struct {
// Expr is the expression to be converted.
Expr ExprNode
// Tp is the conversion type.
Tp *FieldType
// FunctionType is either Cast, Convert or Binary.
FunctionType CastFunctionType
// ExplicitCharSet is true when charset is explicit indicated.
ExplicitCharSet bool
// contains filtered or unexported fields
}
FuncCastExpr is the expression for CAST/CONVERT/BINARY functions.
func NewFuncCastExpr ¶
func NewFuncCastExpr(expr ExprNode, tp *FieldType, functionType CastFunctionType) *FuncCastExpr
NewFuncCastExpr creates a new FuncCastExpr
type FuncNode ¶
type FuncNode interface {
ExprNode
// contains filtered or unexported methods
}
FuncNode represents function call expression node.
type GetFormatSelectorExpr ¶
type GetFormatSelectorExpr struct {
// Selector is the format selector type.
Selector GetFormatSelectorType
// contains filtered or unexported fields
}
GetFormatSelectorExpr is the expression for get_format selector.
func NewGetFormatSelectorExpr ¶
func NewGetFormatSelectorExpr(selector GetFormatSelectorType) *GetFormatSelectorExpr
NewGetFormatSelectorExpr creates a new GetFormatSelectorExpr
func (*GetFormatSelectorExpr) Accept ¶
func (n *GetFormatSelectorExpr) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*GetFormatSelectorExpr) GetFlag ¶
func (en *GetFormatSelectorExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*GetFormatSelectorExpr) GetType ¶
func (en *GetFormatSelectorExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*GetFormatSelectorExpr) GetValue ¶
func (en *GetFormatSelectorExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*GetFormatSelectorExpr) SetFlag ¶
func (en *GetFormatSelectorExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type GetFormatSelectorType ¶
type GetFormatSelectorType int
GetFormatSelectorType is the type for get_format function selector.
const ( GetFormatSelectorDate GetFormatSelectorType = iota + 1 GetFormatSelectorTime GetFormatSelectorDatetime GetFormatSelectorTimestamp )
GetFormatSelector constants.
func (GetFormatSelectorType) String ¶
func (g GetFormatSelectorType) String() string
String returns the string representation of GetFormatSelectorType.
type GroupByClause ¶
GroupByClause represents group by clause.
func (*GroupByClause) Accept ¶
func (n *GroupByClause) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*GroupByClause) OriginTextPosition ¶
func (n *GroupByClause) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*GroupByClause) OriginalText ¶
func (n *GroupByClause) OriginalText() string
OriginalText implements Node interface
func (*GroupByClause) SetOriginTextPosition ¶
func (n *GroupByClause) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type HandleRange ¶
HandleRange represents a handle range.
type HavingClause ¶
type HavingClause struct {
Expr ExprNode
// contains filtered or unexported fields
}
HavingClause represents having clause.
func (*HavingClause) Accept ¶
func (n *HavingClause) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*HavingClause) OriginTextPosition ¶
func (n *HavingClause) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*HavingClause) OriginalText ¶
func (n *HavingClause) OriginalText() string
OriginalText implements Node interface
func (*HavingClause) SetOriginTextPosition ¶
func (n *HavingClause) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type HistogramOperation ¶
type HistogramOperation int
HistogramOperation represents the operation of histogram statistics.
const ( HistogramOperationNop HistogramOperation = iota HistogramOperationDrop )
HistogramOperation types.
type IndexHint ¶
type IndexHint struct {
IndexNames []CIStr
HintType IndexHintType
HintScope IndexHintScope
}
IndexHint represents a hint for optimizer to use/ignore/force for join/order by/group by.
type IndexHintScope ¶
type IndexHintScope int
IndexHintScope is the type for index hint for join, order by or group by.
const ( IndexHintForScan IndexHintScope = iota + 1 IndexHintForJoin IndexHintForOrderBy IndexHintForGroupBy )
Index hint scopes.
type IndexHintType ¶
type IndexHintType int
IndexHintType is the type for index hint use, ignore or force.
const ( IndexHintUse IndexHintType = iota + 1 IndexHintIgnore IndexHintForce IndexHintOrderIndex IndexHintNoOrderIndex )
IndexHintUseType values.
type IndexKeyType ¶
type IndexKeyType int
IndexKeyType is the type for index key.
const ( IndexKeyTypeNone IndexKeyType = iota IndexKeyTypeUnique IndexKeyTypeSpatial IndexKeyTypeFullText )
Index key types.
type IndexLockAndAlgorithm ¶
type IndexLockAndAlgorithm struct {
LockTp LockType
AlgorithmTp AlgorithmType
// contains filtered or unexported fields
}
IndexLockAndAlgorithm stores lock type and algorithm type.
func (*IndexLockAndAlgorithm) Accept ¶
func (n *IndexLockAndAlgorithm) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*IndexLockAndAlgorithm) OriginTextPosition ¶
func (n *IndexLockAndAlgorithm) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*IndexLockAndAlgorithm) OriginalText ¶
func (n *IndexLockAndAlgorithm) OriginalText() string
OriginalText implements Node interface
func (*IndexLockAndAlgorithm) SetOriginTextPosition ¶
func (n *IndexLockAndAlgorithm) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type IndexOption ¶
type IndexOption struct {
KeyBlockSize uint64
Tp IndexType
Comment string
ParserName CIStr
Visibility IndexVisibility
// contains filtered or unexported fields
}
IndexOption is the index options.
func (*IndexOption) Accept ¶
func (n *IndexOption) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*IndexOption) OriginTextPosition ¶
func (n *IndexOption) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*IndexOption) OriginalText ¶
func (n *IndexOption) OriginalText() string
OriginalText implements Node interface
func (*IndexOption) SetOriginTextPosition ¶
func (n *IndexOption) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type IndexPartSpecification ¶
type IndexPartSpecification struct {
Column *ColumnName
Length int
Desc bool
Expr ExprNode
// contains filtered or unexported fields
}
IndexPartSpecification is the specification for index column.
func (*IndexPartSpecification) Accept ¶
func (n *IndexPartSpecification) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*IndexPartSpecification) OriginTextPosition ¶
func (n *IndexPartSpecification) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*IndexPartSpecification) OriginalText ¶
func (n *IndexPartSpecification) OriginalText() string
OriginalText implements Node interface
func (*IndexPartSpecification) SetOriginTextPosition ¶
func (n *IndexPartSpecification) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type IndexVisibility ¶
type IndexVisibility int
IndexVisibility is the type for index visibility.
const ( IndexVisibilityDefault IndexVisibility = iota IndexVisibilityVisible IndexVisibilityInvisible )
Index visibility types.
type InsertStmt ¶
type InsertStmt struct {
// IsReplace indicates whether INSERT or REPLACE.
IsReplace bool
// IgnoreErr indicates ignore error.
IgnoreErr bool
// Table is the table reference for insertion.
Table *TableRefsClause
// Columns is the column list for insertion.
Columns []*ColumnName
// Lists is the value list of each row.
Lists [][]ExprNode
// Setlist is the set value list.
Setlist []*Assignment
// Priority is the insert priority.
Priority int
// OnDuplicate is the on duplicate update clause.
OnDuplicate []*Assignment
// Select is the data source for insertion.
Select ResultSetNode
// PartitionNames is the partition names for insert statement.
PartitionNames []CIStr
// contains filtered or unexported fields
}
InsertStmt is a statement to insert new rows into an existing table.
type IsNullExpr ¶
IsNullExpr represents an IS NULL expression
func NewIsNullExpr ¶
func NewIsNullExpr(expr ExprNode, not bool) *IsNullExpr
NewIsNullExpr creates a new IsNullExpr
func (*IsNullExpr) Accept ¶
func (ine *IsNullExpr) Accept(visitor Visitor) (Node, bool)
Accept implements Node interface
func (*IsNullExpr) GetFlag ¶
func (en *IsNullExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*IsNullExpr) GetType ¶
func (en *IsNullExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*IsNullExpr) GetValue ¶
func (en *IsNullExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*IsNullExpr) SetFlag ¶
func (en *IsNullExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type IsTruthExpr ¶
type IsTruthExpr struct {
// Expr is the expression to be checked.
Expr ExprNode
// Not is true, the expression is "is not true/false".
Not bool
// True indicates checking true or false.
True int64
// contains filtered or unexported fields
}
IsTruthExpr is the expression for true/false check.
func NewIsTruthExpr ¶
func NewIsTruthExpr(expr ExprNode, not bool, isTrue int64) *IsTruthExpr
NewIsTruthExpr creates a new IsTruthExpr
func (*IsTruthExpr) Accept ¶
func (ite *IsTruthExpr) Accept(visitor Visitor) (Node, bool)
Accept implements Node interface
func (*IsTruthExpr) GetFlag ¶
func (en *IsTruthExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*IsTruthExpr) GetType ¶
func (en *IsTruthExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*IsTruthExpr) GetValue ¶
func (en *IsTruthExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*IsTruthExpr) SetFlag ¶
func (en *IsTruthExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type Join ¶
type Join struct {
// Left table can be TableSource or JoinNode.
Left ResultSetNode
// Right table can be TableSource or JoinNode or nil.
Right ResultSetNode
// Tp represents join type.
Tp JoinType
// On represents join on condition.
On *OnCondition
OnCols []*ColumnName
// Using represents join using clause.
Using []*ColumnName
// NaturalJoin represents join is natural join.
NaturalJoin bool
// StraightJoin represents a straight join.
StraightJoin bool
// ExplicitParens indicates explicit parentheses.
ExplicitParens bool
// contains filtered or unexported fields
}
Join represents table join.
func (*Join) OriginTextPosition ¶
func (n *Join) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*Join) OriginalText ¶
func (n *Join) OriginalText() string
OriginalText implements Node interface
func (*Join) SetOriginTextPosition ¶
func (n *Join) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type KillStmt ¶
type KillStmt struct {
// ConnectionID is the connection ID to kill.
ConnectionID uint64
// Query indicates whether to kill query or connection.
Query bool
// TiDBExtension is true if "TIDB" extension is used.
TiDBExtension bool
// contains filtered or unexported fields
}
KillStmt is a statement to kill a connection.
type Limit ¶
Limit is the limit clause.
func (*Limit) OriginTextPosition ¶
func (n *Limit) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*Limit) OriginalText ¶
func (n *Limit) OriginalText() string
OriginalText implements Node interface
func (*Limit) SetOriginTextPosition ¶
func (n *Limit) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type LockTablesStmt ¶
type LockTablesStmt struct {
TableLocks []TableLock
// contains filtered or unexported fields
}
LockTablesStmt is a statement to lock tables.
type MatchAgainst ¶
type MatchAgainst struct {
// ColumnNames are the columns to match.
ColumnNames []*ColumnName
// Against
Against ExprNode
// Modifier
Modifier FulltextSearchModifier
// contains filtered or unexported fields
}
MatchAgainst is the expression for matching against fulltext index.
func NewMatchAgainst ¶
func NewMatchAgainst(columnNames []*ColumnName, against ExprNode, modifier FulltextSearchModifier) *MatchAgainst
NewMatchAgainst creates a new MatchAgainst
func (*MatchAgainst) Accept ¶
func (n *MatchAgainst) Accept(v Visitor) (Node, bool)
Accept implements Node interface.
func (*MatchAgainst) GetFlag ¶
func (en *MatchAgainst) GetFlag() uint64
GetFlag implements ExprNode interface
func (*MatchAgainst) GetType ¶
func (en *MatchAgainst) GetType() *FieldType
GetType implements ExprNode interface
func (*MatchAgainst) GetValue ¶
func (en *MatchAgainst) GetValue() interface{}
GetValue implements ExprNode interface
func (*MatchAgainst) SetFlag ¶
func (en *MatchAgainst) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type MaxValueExpr ¶
type MaxValueExpr struct {
// contains filtered or unexported fields
}
MaxValueExpr is the expression for "maxvalue" used in partition.
func (*MaxValueExpr) Accept ¶
func (n *MaxValueExpr) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*MaxValueExpr) GetFlag ¶
func (en *MaxValueExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*MaxValueExpr) GetType ¶
func (en *MaxValueExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*MaxValueExpr) GetValue ¶
func (en *MaxValueExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*MaxValueExpr) SetFlag ¶
func (en *MaxValueExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type NameResolutionContext ¶
type NameResolutionContext struct {
// OuterContext is the context to search in when an Item cannot be
// resolved in this context (the context of an outer select).
// Corresponds to MySQL's Name_resolution_context::outer_context.
OuterContext *NameResolutionContext
// TableList is the list of tables used to resolve the items of this context.
// Usually these are tables from the FROM clause of SELECT statement.
// Corresponds to MySQL's Name_resolution_context::table_list.
TableList *TableSource
// FirstNameResolutionTable is the first table to search in for name resolution.
// Corresponds to MySQL's Name_resolution_context::first_name_resolution_table.
FirstNameResolutionTable *TableSource
// LastNameResolutionTable is the last table to search in for name resolution.
// Corresponds to MySQL's Name_resolution_context::last_name_resolution_table.
LastNameResolutionTable *TableSource
// SelectStmt is the SELECT statement this context belongs to.
// Corresponds to MySQL's Name_resolution_context::query_block.
SelectStmt *SelectStmt
// ResolveInSelectList indicates whether to resolve items against
// the SELECT list (for column alias resolution).
// Corresponds to MySQL's Name_resolution_context::resolve_in_select_list.
//
// MySQL rules for column alias visibility:
// - WHERE clause: column aliases NOT visible
// - HAVING clause: column aliases visible
// - ORDER BY clause: column aliases visible
// - GROUP BY clause: column aliases visible (MySQL extension)
ResolveInSelectList bool
// ContextID is used for debugging and tracking (similar to how MySQL
// uses DBUG_PRINT for outer_field tracking).
ContextID int
}
NameResolutionContext represents a name resolution context for a query block. Mirrors MySQL's Name_resolution_context structure (sql/item.h:398-482).
MySQL's Name_resolution_context contains:
- outer_context: context of outer select for subqueries
- table_list: tables used to resolve items
- first/last_name_resolution_table: range of tables for resolution
- query_block: the Query_block this context belongs to
- resolve_in_select_list: whether to resolve in SELECT list (for column aliases)
func NewNameResolutionContext ¶
func NewNameResolutionContext(outer *NameResolutionContext) *NameResolutionContext
NewNameResolutionContext creates a new name resolution context.
func (*NameResolutionContext) Init ¶
func (ctx *NameResolutionContext) Init()
Init initializes a name resolution context. Corresponds to MySQL's Name_resolution_context::init().
func (*NameResolutionContext) ResolveInTableListOnly ¶
func (ctx *NameResolutionContext) ResolveInTableListOnly(tables *TableSource)
ResolveInTableListOnly sets up context to resolve only in table list. Corresponds to MySQL's Name_resolution_context::resolve_in_table_list_only().
type NameResolutionContextState ¶
type NameResolutionContextState struct {
// contains filtered or unexported fields
}
NameResolutionContextState is used to save and restore context state. Corresponds to MySQL's Name_resolution_context_state (sql/item.h:519-553).
func (*NameResolutionContextState) RestoreState ¶
func (s *NameResolutionContextState) RestoreState(ctx *NameResolutionContext, tableList *TableSource)
RestoreState restores a name resolution context from saved state.
func (*NameResolutionContextState) SaveState ¶
func (s *NameResolutionContextState) SaveState(ctx *NameResolutionContext, tableList *TableSource)
SaveState saves the state of a name resolution context.
type NoOpTableProvider ¶
type NoOpTableProvider struct{}
func (*NoOpTableProvider) GetPrimaryKeyColumns ¶
func (*NoOpTableProvider) GetPrimaryKeyColumns(schema, tableName string) []string
func (*NoOpTableProvider) GetTableColumns ¶
func (*NoOpTableProvider) GetTableColumns(schema, tableName string) []string
type Node ¶
type Node interface {
// Accept accepts Visitor to visit itself.
// The returned node should replace original node.
// ok returns false to stop visiting.
Accept(v Visitor) (node Node, ok bool)
// Text returns the utf8 encoding text of the element.
Text() string
// OriginalText returns the original text of the element.
OriginalText() string
// SetText sets original text to the Node.
SetText(text string)
// SetOriginTextPosition set the start offset of this node in the origin text.
SetOriginTextPosition(offset int)
// OriginTextPosition get the start offset of this node in the origin text.
OriginTextPosition() int
}
Node is the interface for all nodes in AST. Interfaces embedding Node should have 'Node' name suffix.
type OnCondition ¶
type OnCondition struct {
Expr ExprNode
// contains filtered or unexported fields
}
OnCondition represents JOIN on condition.
func (*OnCondition) Accept ¶
func (n *OnCondition) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*OnCondition) OriginTextPosition ¶
func (n *OnCondition) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*OnCondition) OriginalText ¶
func (n *OnCondition) OriginalText() string
OriginalText implements Node interface
func (*OnCondition) SetOriginTextPosition ¶
func (n *OnCondition) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type OnDeleteOpt ¶
type OnDeleteOpt struct {
ReferOpt ReferOptionType
// contains filtered or unexported fields
}
OnDeleteOpt is ON DELETE option.
func (*OnDeleteOpt) OriginTextPosition ¶
func (n *OnDeleteOpt) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*OnDeleteOpt) OriginalText ¶
func (n *OnDeleteOpt) OriginalText() string
OriginalText implements Node interface
func (*OnDeleteOpt) SetOriginTextPosition ¶
func (n *OnDeleteOpt) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type OnDuplicateKeyHandlingType ¶
type OnDuplicateKeyHandlingType int
OnDuplicateKeyHandlingType is the type for handling on duplicate key.
const ( OnDuplicateKeyHandlingError OnDuplicateKeyHandlingType = iota OnDuplicateKeyHandlingIgnore OnDuplicateKeyHandlingReplace )
OnDuplicateKeyHandling types.
type OnUpdateOpt ¶
type OnUpdateOpt struct {
ReferOpt ReferOptionType
// contains filtered or unexported fields
}
OnUpdateOpt is ON UPDATE option.
func (*OnUpdateOpt) OriginTextPosition ¶
func (n *OnUpdateOpt) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*OnUpdateOpt) OriginalText ¶
func (n *OnUpdateOpt) OriginalText() string
OriginalText implements Node interface
func (*OnUpdateOpt) SetOriginTextPosition ¶
func (n *OnUpdateOpt) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type Op ¶
type Op int
Op is opcode type.
const ( OpLogicAnd Op = iota + 1 OpLeftShift OpRightShift OpLogicOr OpGE OpLE OpEQ OpNE OpLT OpGT OpPlus OpMinus OpAnd OpOr OpMod OpXor OpDiv OpMul OpNot OpNot2 OpBitNeg OpIntDiv OpLogicXor OpNullEQ OpIn OpLike OpCase OpRegexp OpIsNull OpIsTruth OpIsFalsity )
List operators.
type OrderByClause ¶
type OrderByClause struct {
Items []*ByItem
ForUnion bool
// contains filtered or unexported fields
}
OrderByClause represents order by clause.
func (*OrderByClause) Accept ¶
func (n *OrderByClause) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*OrderByClause) OriginTextPosition ¶
func (n *OrderByClause) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*OrderByClause) OriginalText ¶
func (n *OrderByClause) OriginalText() string
OriginalText implements Node interface
func (*OrderByClause) SetOriginTextPosition ¶
func (n *OrderByClause) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type ParenthesesExpr ¶
type ParenthesesExpr struct {
Expr ExprNode
// contains filtered or unexported fields
}
ParenthesesExpr represents a parentheses expression
func NewParenthesesExpr ¶
func NewParenthesesExpr(expr ExprNode) *ParenthesesExpr
NewParenthesesExpr creates a new ParenthesesExpr
func (*ParenthesesExpr) Accept ¶
func (pe *ParenthesesExpr) Accept(visitor Visitor) (Node, bool)
Accept implements Node interface
func (*ParenthesesExpr) GetFlag ¶
func (en *ParenthesesExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*ParenthesesExpr) GetType ¶
func (en *ParenthesesExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*ParenthesesExpr) GetValue ¶
func (en *ParenthesesExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*ParenthesesExpr) SetFlag ¶
func (en *ParenthesesExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type PartitionByClause ¶
type PartitionByClause struct {
Items []*ByItem
// contains filtered or unexported fields
}
PartitionByClause represents partition by clause for window function.
func (*PartitionByClause) Accept ¶
func (n *PartitionByClause) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*PartitionByClause) OriginTextPosition ¶
func (n *PartitionByClause) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*PartitionByClause) OriginalText ¶
func (n *PartitionByClause) OriginalText() string
OriginalText implements Node interface
func (*PartitionByClause) SetOriginTextPosition ¶
func (n *PartitionByClause) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type PartitionDefinition ¶
type PartitionDefinition struct {
Name CIStr
LessThan []ExprNode
InValues [][]ExprNode
MaxValue bool
Comment string
Options []*TableOption
// contains filtered or unexported fields
}
PartitionDefinition represents a single partition definition.
func (*PartitionDefinition) Accept ¶
func (n *PartitionDefinition) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*PartitionDefinition) OriginTextPosition ¶
func (n *PartitionDefinition) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*PartitionDefinition) OriginalText ¶
func (n *PartitionDefinition) OriginalText() string
OriginalText implements Node interface
func (*PartitionDefinition) SetOriginTextPosition ¶
func (n *PartitionDefinition) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type PartitionOptions ¶
type PartitionOptions struct {
Tp PartitionType
Num uint64
Expr ExprNode
ColumnNames []*ColumnName
Definitions []*PartitionDefinition
Sub *PartitionOptions
Linear bool
// contains filtered or unexported fields
}
PartitionOptions represents partition options.
func (*PartitionOptions) Accept ¶
func (n *PartitionOptions) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*PartitionOptions) OriginTextPosition ¶
func (n *PartitionOptions) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*PartitionOptions) OriginalText ¶
func (n *PartitionOptions) OriginalText() string
OriginalText implements Node interface
func (*PartitionOptions) SetOriginTextPosition ¶
func (n *PartitionOptions) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type PartitionType ¶
type PartitionType int
PartitionType is partition type.
const ( PartitionTypeRange PartitionType = iota PartitionTypeHash PartitionTypeList PartitionTypeKey PartitionTypeSystemTime PartitionTypeNone )
Partition types.
type PatternInExpr ¶
type PatternInExpr struct {
Expr ExprNode
List []ExprNode
Not bool
Sel *SubqueryExpr
// contains filtered or unexported fields
}
PatternInExpr represents an IN expression
func NewPatternInExpr ¶
func NewPatternInExpr(expr ExprNode, list []ExprNode, not bool) *PatternInExpr
NewPatternInExpr creates a new PatternInExpr
func (*PatternInExpr) Accept ¶
func (pie *PatternInExpr) Accept(visitor Visitor) (Node, bool)
Accept implements Node interface
func (*PatternInExpr) GetFlag ¶
func (en *PatternInExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*PatternInExpr) GetType ¶
func (en *PatternInExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*PatternInExpr) GetValue ¶
func (en *PatternInExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*PatternInExpr) SetFlag ¶
func (en *PatternInExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type PatternLikeOrIlikeExpr ¶
type PatternLikeOrIlikeExpr struct {
// Expr is the expression to be checked.
Expr ExprNode
// Pattern is the like expression.
Pattern ExprNode
// Not is true, the expression is "not like".
Not bool
// IsLike is true for LIKE, false for ILIKE.
IsLike bool
// Escape is the escape character.
Escape byte
// PatChars is the pattern characters.
PatChars []byte
// PatTypes is the pattern types.
PatTypes []byte
// contains filtered or unexported fields
}
PatternLikeOrIlikeExpr is the expression for like operator, e.g, expr like "%123%"
func NewPatternLikeOrIlikeExpr ¶
func NewPatternLikeOrIlikeExpr(expr, pattern ExprNode, not bool, escape byte) *PatternLikeOrIlikeExpr
NewPatternLikeOrIlikeExpr creates a new PatternLikeOrIlikeExpr
func (*PatternLikeOrIlikeExpr) Accept ¶
func (plie *PatternLikeOrIlikeExpr) Accept(visitor Visitor) (Node, bool)
Accept implements Node interface
func (*PatternLikeOrIlikeExpr) GetFlag ¶
func (en *PatternLikeOrIlikeExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*PatternLikeOrIlikeExpr) GetType ¶
func (en *PatternLikeOrIlikeExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*PatternLikeOrIlikeExpr) GetValue ¶
func (en *PatternLikeOrIlikeExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*PatternLikeOrIlikeExpr) SetFlag ¶
func (en *PatternLikeOrIlikeExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type PatternRegexpExpr ¶
type PatternRegexpExpr struct {
Expr ExprNode
Pattern ExprNode
Not bool
// contains filtered or unexported fields
}
PatternRegexpExpr represents a REGEXP expression
func NewPatternRegexpExpr ¶
func NewPatternRegexpExpr(expr, pattern ExprNode, not bool) *PatternRegexpExpr
NewPatternRegexpExpr creates a new PatternRegexpExpr
func (*PatternRegexpExpr) Accept ¶
func (pre *PatternRegexpExpr) Accept(visitor Visitor) (Node, bool)
Accept implements Node interface
func (*PatternRegexpExpr) GetFlag ¶
func (en *PatternRegexpExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*PatternRegexpExpr) GetType ¶
func (en *PatternRegexpExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*PatternRegexpExpr) GetValue ¶
func (en *PatternRegexpExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*PatternRegexpExpr) SetFlag ¶
func (en *PatternRegexpExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type PositionExpr ¶
type PositionExpr struct {
N uint64
P interface{} // may be *ColumnName or other position indicator
// contains filtered or unexported fields
}
PositionExpr represents a position expression (for ORDER BY, LIMIT)
func NewPositionExpr ¶
func NewPositionExpr(n uint64, p interface{}) *PositionExpr
NewPositionExpr creates a new PositionExpr
func (*PositionExpr) Accept ¶
func (pe *PositionExpr) Accept(visitor Visitor) (Node, bool)
Accept implements Node interface
func (*PositionExpr) GetFlag ¶
func (en *PositionExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*PositionExpr) GetType ¶
func (en *PositionExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*PositionExpr) GetValue ¶
func (en *PositionExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*PositionExpr) SetFlag ¶
func (en *PositionExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type QueryContextType ¶
type QueryContextType int
QueryContextType indicates which part of the query is being resolved. Used to determine column alias visibility.
const ( // QueryContextSelect is for SELECT field list. QueryContextSelect QueryContextType = iota // QueryContextWhere is for WHERE clause (column aliases NOT visible). QueryContextWhere // QueryContextHaving is for HAVING clause (column aliases visible). QueryContextHaving // QueryContextOrderBy is for ORDER BY clause (column aliases visible). QueryContextOrderBy // QueryContextGroupBy is for GROUP BY clause (column aliases visible). QueryContextGroupBy // QueryContextOn is for JOIN ON clause. QueryContextOn )
type ReferOptionType ¶
type ReferOptionType int
ReferOptionType is the type for referential actions.
const ( ReferOptionNoOption ReferOptionType = iota ReferOptionRestrict ReferOptionCascade ReferOptionSetNull ReferOptionNoAction ReferOptionSetDefault )
Referential actions.
type ReferenceDef ¶
type ReferenceDef struct {
Table *TableName
IndexPartSpec []*IndexPartSpecification
OnDelete *OnDeleteOpt
OnUpdate *OnUpdateOpt
Match MatchType
// contains filtered or unexported fields
}
ReferenceDef is the reference definition for foreign key.
func (*ReferenceDef) Accept ¶
func (n *ReferenceDef) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*ReferenceDef) OriginTextPosition ¶
func (n *ReferenceDef) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*ReferenceDef) OriginalText ¶
func (n *ReferenceDef) OriginalText() string
OriginalText implements Node interface
func (*ReferenceDef) SetOriginTextPosition ¶
func (n *ReferenceDef) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type ReleaseSavepointStmt ¶
type ReleaseSavepointStmt struct {
Name string
// contains filtered or unexported fields
}
ReleaseSavepointStmt is a statement to release the savepoint.
type RenameTableStmt ¶
type RenameTableStmt struct {
TableToTables []*TableToTable
// contains filtered or unexported fields
}
RenameTableStmt is a statement to rename a table.
type ResolvedField ¶
type ResolvedField struct {
// OriginField is the original SelectField from the AST.
// If this field was expanded from a wildcard (*), this points to
// the SelectField containing the WildCardField.
// If this is a regular field, it points to itself.
OriginField *SelectField
// Column contains resolved column information.
// For wildcard-expanded fields, this has the actual column name.
// For column expressions, this is the resolved ColumnName.
// For other expressions (functions, constants), this is nil.
Column *ColumnName
// Expr is the actual expression for this field.
// For wildcard-expanded fields, this is a ColumnNameExpr.
// For regular fields, this is the original expression from SelectField.
Expr ExprNode
// AsName is the alias for this field (if any).
// For wildcard-expanded fields, this is typically empty.
// For aliased fields like "SELECT id AS user_id", this is "user_id".
AsName CIStr
// TableSource indicates which table this field came from.
// For wildcard expansion, this identifies the source table.
// For derived tables, this links to the derived table's TableSource.
TableSource *TableSource
// IsFromWildcard indicates if this field was expanded from a wildcard (*).
IsFromWildcard bool
}
ResolvedField represents a resolved field in SELECT list after wildcard expansion. When SELECT * is expanded, each expanded column creates a ResolvedField. This structure preserves the original SelectField information while providing the resolved column details.
For example, given:
SELECT * FROM users
If users has columns (id, name, email), this produces three ResolvedField entries:
- ResolvedField{Column: &ColumnName{Name: "id"}, OriginField: <the * field>}
- ResolvedField{Column: &ColumnName{Name: "name"}, OriginField: <the * field>}
- ResolvedField{Column: &ColumnName{Name: "email"}, OriginField: <the * field>}
type ResolvedFieldList ¶
type ResolvedFieldList struct {
// Fields contains all resolved fields, with wildcards expanded.
Fields []*ResolvedField
// OriginalFields points to the original FieldList for reference.
OriginalFields *FieldList
}
ResolvedFieldList holds the list of resolved fields after wildcard expansion.
type ResultSetNode ¶
type ResultSetNode interface {
Node
// contains filtered or unexported methods
}
ResultSetNode interface has a ResultFields property, represents a Node that returns result set. Implementations include SelectStmt, SubqueryExpr, TableSource, TableName, Join and SetOprStmt.
type RollbackStmt ¶
type RollbackStmt struct {
// SavepointName is the savepoint name.
SavepointName string
// CompletionType indicates the completion type.
CompletionType CompletionType
// contains filtered or unexported fields
}
RollbackStmt is a statement to roll back the current transaction.
type RowExpr ¶
type RowExpr struct {
Values []ExprNode
// contains filtered or unexported fields
}
RowExpr represents a row expression
func (*RowExpr) GetType ¶
func (en *RowExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*RowExpr) GetValue ¶
func (en *RowExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*RowExpr) SetFlag ¶
func (en *RowExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type RowFormat ¶
type RowFormat int
RowFormat is the table row format type.
const ( RowFormatDefault RowFormat = iota RowFormatDynamic RowFormatFixed RowFormatCompressed RowFormatRedundant RowFormatCompact TokuDBRowFormatDefault TokuDBRowFormatFast TokuDBRowFormatSmall TokuDBRowFormatZlib TokuDBRowFormatQuickLZ TokuDBRowFormatLzma TokuDBRowFormatSnappy TokuDBRowFormatUncompressed )
Row format types.
type SavepointStmt ¶
type SavepointStmt struct {
Name string
// contains filtered or unexported fields
}
SavepointStmt is a statement to save the current state of the transaction.
type SelectField ¶
type SelectField struct {
// Offset is used to get original text.
Offset int
// WildCard is not nil, Expr will be nil.
WildCard *WildCardField
// Expr is not nil, WildCard will be nil.
Expr ExprNode
// AsName is alias name for Expr.
AsName CIStr
// Auxiliary stands for if this field is auxiliary.
Auxiliary bool
// contains filtered or unexported fields
}
SelectField represents fields in select statement.
func (*SelectField) Accept ¶
func (n *SelectField) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*SelectField) OriginTextPosition ¶
func (n *SelectField) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*SelectField) OriginalText ¶
func (n *SelectField) OriginalText() string
OriginalText implements Node interface
func (*SelectField) SetOriginTextPosition ¶
func (n *SelectField) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type SelectLockInfo ¶
type SelectLockInfo struct {
LockType SelectLockType
WaitSec uint64
Tables []*TableName
}
SelectLockInfo contains the lock type and tables.
type SelectLockType ¶
type SelectLockType int
SelectLockType is the lock type for SelectStmt.
const ( SelectLockNone SelectLockType = iota SelectLockForUpdate SelectLockForUpdateNoWait SelectLockForUpdateWaitN SelectLockForUpdateSkipLocked )
Select lock types.
type SelectStmt ¶
type SelectStmt struct {
// SelectStmtOpts wraps around select hints and switches.
*SelectStmtOpts
// Distinct represents whether the select has distinct option.
Distinct bool
// From is the from clause of the query.
From *TableRefsClause
// Where is the where clause in select statement.
Where ExprNode
// Fields is the select expression list.
Fields *FieldList
// GroupBy is the group by expression list.
GroupBy *GroupByClause
// Having is the having condition.
Having *HavingClause
// OrderBy is the ordering expression list.
OrderBy *OrderByClause
// Limit is the limit clause.
Limit *Limit
// LockInfo is the lock type
LockInfo *SelectLockInfo
// IsInBraces indicates whether it's a stmt in brace.
IsInBraces bool
// QueryBlockOffset indicates the order of this SelectStmt if counted from left to right in the sql text.
QueryBlockOffset int
// AfterSetOperator indicates the SelectStmt after which type of set operator
AfterSetOperator *SetOprType
// Kind refer to three kind of statement: SelectStmt, TableStmt and ValuesStmt
Kind SelectStmtKind
// Lists is filled only when Kind == SelectStmtKindValues
Lists []*RowExpr
// With is the with clause.
With *WithClause
// contains filtered or unexported fields
}
SelectStmt represents the select query node.
type SelectStmtKind ¶
type SelectStmtKind uint8
SelectStmtKind represents the kind of SelectStmt.
const ( // SelectStmtKindSelect is SELECT. SelectStmtKindSelect SelectStmtKind = iota // SelectStmtKindTable is TABLE. SelectStmtKindTable // SelectStmtKindValues is VALUES. SelectStmtKindValues )
type SelectStmtOpts ¶
type SelectStmtOpts struct {
Distinct bool
SQLBigResult bool
SQLBufferResult bool
SQLCache bool
SQLSmallResult bool
CalcFoundRows bool
StraightJoin bool
Priority int
ExplicitAll bool
}
SelectStmtOpts wraps around select hints and switches.
type SetCollationExpr ¶
type SetCollationExpr struct {
// Expr is the expression to be set.
Expr ExprNode
// Collate is the name of collation to set.
Collate string
// contains filtered or unexported fields
}
SetCollationExpr is the expression for the `COLLATE collation_name` clause.
func NewSetCollationExpr ¶
func NewSetCollationExpr(expr ExprNode, collate string) *SetCollationExpr
NewSetCollationExpr creates a new SetCollationExpr
func (*SetCollationExpr) Accept ¶
func (n *SetCollationExpr) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*SetCollationExpr) GetFlag ¶
func (en *SetCollationExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*SetCollationExpr) GetType ¶
func (en *SetCollationExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*SetCollationExpr) GetValue ¶
func (en *SetCollationExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*SetCollationExpr) SetFlag ¶
func (en *SetCollationExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type SetOprSelectList ¶
type SetOprSelectList struct {
With *WithClause
AfterSetOperator *SetOprType
Selects []Node
// contains filtered or unexported fields
}
SetOprSelectList represents a union select list.
func (*SetOprSelectList) Accept ¶
func (n *SetOprSelectList) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*SetOprSelectList) OriginTextPosition ¶
func (n *SetOprSelectList) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*SetOprSelectList) OriginalText ¶
func (n *SetOprSelectList) OriginalText() string
OriginalText implements Node interface
func (*SetOprSelectList) SetOriginTextPosition ¶
func (n *SetOprSelectList) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type SetOprStmt ¶
type SetOprStmt struct {
SelectList *SetOprSelectList
OrderBy *OrderByClause
Limit *Limit
With *WithClause
// contains filtered or unexported fields
}
SetOprStmt represents a union/except/intersect statement.
type SetOprType ¶
type SetOprType uint8
SetOprType is the type for set DMC operations UNION/EXCEPT/INTERSECT.
const ( // Union is UNION type. Union SetOprType = iota // UnionAll is UNION ALL type. UnionAll // Except is EXCEPT type. Except // ExceptAll is EXCEPT ALL type. ExceptAll // Intersect is INTERSECT type. Intersect // IntersectAll is INTERSECT ALL type. IntersectAll )
type SetStmt ¶
type SetStmt struct {
// Variables is the list of variable assignment.
Variables []*VariableAssignment
// contains filtered or unexported fields
}
SetStmt is a statement to set variable.
type ShowSlow ¶
type ShowSlow struct {
Tp ShowSlowType
Count uint64
Kind ShowSlowKind
}
ShowSlow is used for the ADMIN SHOW SLOW statement.
type ShowSlowKind ¶
type ShowSlowKind int
ShowSlowKind defines the kind for SHOW SLOW.
const ( ShowSlowKindDefault ShowSlowKind = iota ShowSlowKindInternal ShowSlowKindAll )
ShowSlowKind values.
type ShowSlowType ¶
type ShowSlowType int
ShowSlowType defines the type for SHOW SLOW.
const ( ShowSlowTop ShowSlowType = iota ShowSlowRecent )
ShowSlowType values.
type ShowStmt ¶
type ShowStmt struct {
Tp ShowStmtType // Databases/Tables/Columns/....
DBName string
Table *TableName // Used for showing columns.
// Procedure's naming method is consistent with the table name
Procedure *TableName
Partition CIStr // Used for showing partition.
Column *ColumnName // Used for `desc table column`.
IndexName CIStr
ResourceGroupName string // used for showing resource group
Flag int // Some flag parsed from sql, such as FULL.
Full bool
IfNotExists bool // Used for `show create database if not exists`
Extended bool // Used for `show extended columns from ...`
Limit *Limit
CountWarningsOrErrors bool // Used for showing count(*) warnings | errors
// GlobalScope is used by `show variables` and `show bindings`
GlobalScope bool
Pattern *PatternLikeOrIlikeExpr
Where ExprNode
ShowProfileTypes []int // Used for `SHOW PROFILE` syntax
ShowProfileArgs *int64 // Used for `SHOW PROFILE` syntax
ShowProfileLimit *Limit // Used for `SHOW PROFILE` syntax
// contains filtered or unexported fields
}
ShowStmt is a statement to provide information about databases, tables, columns and so on.
type ShowStmtType ¶
type ShowStmtType int
ShowStmtType is the type for SHOW statement.
const ( ShowNone ShowStmtType = iota ShowEngines ShowDatabases ShowTables ShowTableStatus ShowColumns ShowWarnings ShowCharset ShowVariables ShowStatus ShowCollation ShowCreateTable ShowCreateView ShowCreateUser ShowCreateSequence ShowCreatePlacementPolicy ShowGrants ShowTriggers ShowProcedureStatus ShowFunctionStatus ShowIndex ShowProcessList ShowCreateDatabase ShowConfig ShowEvents ShowStatsMeta ShowStatsHistograms ShowStatsBuckets ShowStatsHealthy ShowStatsTopN ShowStatsLocked ShowHistogramsInFlight ShowColumnStatsUsage ShowPlugins ShowProfile ShowProfiles ShowMasterStatus ShowPrivileges ShowErrors ShowBindings ShowBindingCacheStatus ShowPumpStatus ShowDrainerStatus ShowOpenTables ShowAnalyzeStatus ShowRegions ShowBuiltins ShowTableNextRowId ShowBackups ShowRestores ShowPlacement ShowPlacementForDatabase ShowPlacementForTable ShowPlacementForPartition ShowPlacementLabels ShowSessionStates ShowCreateResourceGroup ShowImports ShowCreateProcedure )
Show statement types.
type SpecialFuncType ¶
type SpecialFuncType int
SpecialFuncType is the type for special function expression
const ( // SpecialFuncCast is CAST function SpecialFuncCast SpecialFuncType = iota // SpecialFuncConvert is CONVERT function SpecialFuncConvert // SpecialFuncSubstr is SUBSTR function SpecialFuncSubstr // SpecialFuncSubstring is SUBSTRING function SpecialFuncSubstring // SpecialFuncTrim is TRIM function SpecialFuncTrim // SpecialFuncDateArith is date arithmetic function SpecialFuncDateArith // SpecialFuncDateDiff is date diff function SpecialFuncDateDiff // SpecialFuncTimeDiff is time diff function SpecialFuncTimeDiff // SpecialFuncTimestampDiff is timestamp diff function SpecialFuncTimestampDiff // SpecialFuncAndAnd is && function SpecialFuncAndAnd // SpecialFuncLogicOr is || function SpecialFuncLogicOr // SpecialFuncLogicAnd is & function SpecialFuncLogicAnd // SpecialFuncCase is CASE WHEN function SpecialFuncCase // SpecialFuncGreatest is GREATEST function SpecialFuncGreatest // SpecialFuncLeast is LEAST function SpecialFuncLeast )
type StatementScope ¶
type StatementScope int
StatementScope is the scope of statement.
const ( StatementScopeNone StatementScope = iota StatementScopeSession StatementScopeInstance StatementScopeGlobal )
StatementScope values.
type StmtNode ¶
type StmtNode interface {
Node
// contains filtered or unexported methods
}
StmtNode represents statement node. Name of implementations should have 'Stmt' suffix.
func ConvertTiDBStmtToCustom ¶
ConvertTiDBStmtToCustom converts a TiDB statement to a custom statement
type SubqueryExpr ¶
type SubqueryExpr struct {
// Query is the query SelectNode.
Query ResultSetNode
Evaluated bool
MultiRows bool
Exists bool
// contains filtered or unexported fields
}
SubqueryExpr represents a subquery.
func (*SubqueryExpr) Accept ¶
func (n *SubqueryExpr) Accept(v Visitor) (Node, bool)
Accept implements Node interface
func (*SubqueryExpr) GetFlag ¶
func (en *SubqueryExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*SubqueryExpr) GetType ¶
func (en *SubqueryExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*SubqueryExpr) GetValue ¶
func (en *SubqueryExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*SubqueryExpr) SetFlag ¶
func (en *SubqueryExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type TableInfoProvider ¶
type TableInfoProvider interface {
GetTableColumns(schema, tableName string) []string
GetPrimaryKeyColumns(schema, tableName string) []string
}
TableInfoProvider is an interface for obtaining information for base tables.
type TableLock ¶
type TableLock struct {
Table *TableName
Type TableLockType
}
TableLock contains table name and lock type.
type TableLockType ¶
type TableLockType byte
LockType is the type for lock type.
const ( TableReadLock TableLockType = iota + 1 TableWriteLock TableReadLocalLock TableLowPriorityWriteLock )
Lock types.
type TableName ¶
type TableName struct {
Schema CIStr
Name CIStr
IndexHints []*IndexHint
PartitionNames []CIStr
// IsAlias indicates whether this table name is an alias.
IsAlias bool
// contains filtered or unexported fields
}
TableName represents a table name.
func ConvertTableName ¶
func (*TableName) OriginTextPosition ¶
func (n *TableName) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*TableName) OriginalText ¶
func (n *TableName) OriginalText() string
OriginalText implements Node interface
func (*TableName) SetOriginTextPosition ¶
func (n *TableName) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type TableNameExpr ¶
type TableNameExpr struct {
// Name is the referenced object name expression.
Name *TableName
// contains filtered or unexported fields
}
TableNameExpr represents a table-level object name expression, such as sequence/table/view etc.
func (*TableNameExpr) Accept ¶
func (n *TableNameExpr) Accept(v Visitor) (Node, bool)
Accept implements Node interface.
func (*TableNameExpr) GetFlag ¶
func (en *TableNameExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*TableNameExpr) GetType ¶
func (en *TableNameExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*TableNameExpr) GetValue ¶
func (en *TableNameExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*TableNameExpr) SetFlag ¶
func (en *TableNameExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type TableOption ¶
type TableOption struct {
Tp TableOptionType
Default bool
StrValue string
UintValue uint64
BoolValue bool
// contains filtered or unexported fields
}
TableOption is table option.
func (*TableOption) Accept ¶
func (n *TableOption) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*TableOption) OriginTextPosition ¶
func (n *TableOption) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*TableOption) OriginalText ¶
func (n *TableOption) OriginalText() string
OriginalText implements Node interface
func (*TableOption) SetOriginTextPosition ¶
func (n *TableOption) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type TableOptionType ¶
type TableOptionType int
TableOptionType is the type for table option.
const ( TableOptionNone TableOptionType = iota TableOptionEngine TableOptionCharset TableOptionCollate TableOptionAutoIncrement TableOptionAutoIdCache TableOptionAutoRandomBase TableOptionComment TableOptionAvgRowLength TableOptionCheckSum TableOptionCompression TableOptionConnection TableOptionPassword TableOptionKeyBlockSize TableOptionMaxRows TableOptionMinRows TableOptionDelayKeyWrite TableOptionRowFormat TableOptionStatsPersistent TableOptionStatsAutoRecalc TableOptionShardRowID TableOptionPreSplitRegion TableOptionPackKeys TableOptionTablespace TableOptionNodegroup TableOptionDataDirectory TableOptionIndexDirectory TableOptionStorageMedia TableOptionStatsSamplePages TableOptionSecondaryEngine TableOptionSecondaryEngineNull TableOptionInsertMethod TableOptionTableCheckSum TableOptionUnion TableOptionEncryption TableOptionTTL TableOptionTTLEnable TableOptionTTLJobInterval TableOptionPlacementPolicy TableOptionStatsBuckets TableOptionStatsTopN TableOptionStatsConcurrency )
Table option types.
type TableRefsClause ¶
type TableRefsClause struct {
TableRefs *Join
// contains filtered or unexported fields
}
TableRefsClause represents table references clause in dml statement.
func (*TableRefsClause) Accept ¶
func (n *TableRefsClause) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*TableRefsClause) OriginTextPosition ¶
func (n *TableRefsClause) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*TableRefsClause) OriginalText ¶
func (n *TableRefsClause) OriginalText() string
OriginalText implements Node interface
func (*TableRefsClause) SetOriginTextPosition ¶
func (n *TableRefsClause) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type TableSource ¶
type TableSource struct {
// Source is the source of the data, can be a TableName,
// a SelectStmt, a SetOprStmt, or a JoinNode.
Source ResultSetNode
// AsName is the alias name of the table source.
// Corresponds to MySQL's Table_ref::alias.
AsName CIStr
// DBName is the database/schema name.
// Corresponds to MySQL's Table_ref::db.
DBName CIStr
// ActualTableName is the actual table name (not alias).
// Corresponds to MySQL's Table_ref::table_name.
ActualTableName CIStr
// NextNameResolutionTable is used for name resolution traversal.
// Corresponds to MySQL's Table_ref::next_name_resolution_table.
NextNameResolutionTable *TableSource
// FieldTranslation stores column mappings for derived tables/views.
// Corresponds to MySQL's Table_ref::field_translation.
// Maps column alias -> underlying expression.
FieldTranslation []*FieldTranslator
// IsDerivedTable indicates if this is a derived table (subquery in FROM).
IsDerivedTable bool
// contains filtered or unexported fields
}
TableSource represents table source with a name. Mirrors MySQL's Table_ref structure.
func (*TableSource) Accept ¶
func (n *TableSource) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*TableSource) Alias ¶
func (n *TableSource) Alias() CIStr
Alias returns the alias or actual table name. Corresponds to MySQL's Table_ref::alias behavior.
func (*TableSource) IsAliased ¶
func (n *TableSource) IsAliased() bool
IsAliased returns true if this table has an alias different from actual name.
func (*TableSource) OriginTextPosition ¶
func (n *TableSource) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*TableSource) OriginalText ¶
func (n *TableSource) OriginalText() string
OriginalText implements Node interface
func (*TableSource) SetOriginTextPosition ¶
func (n *TableSource) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type TableToTable ¶
type TableToTable struct {
OldTable *TableName
NewTable *TableName
// contains filtered or unexported fields
}
TableToTable represents table to table in rename statement.
func (*TableToTable) Accept ¶
func (n *TableToTable) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*TableToTable) OriginTextPosition ¶
func (n *TableToTable) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*TableToTable) OriginalText ¶
func (n *TableToTable) OriginalText() string
OriginalText implements Node interface
func (*TableToTable) SetOriginTextPosition ¶
func (n *TableToTable) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type TemporaryKeyword ¶
type TemporaryKeyword int
TemporaryKeyword is used for create/drop table statements.
const ( TemporaryNone TemporaryKeyword = iota TemporaryGlobal TemporaryLocal )
Temporary table keywords.
type TimeUnitExpr ¶
type TimeUnitExpr struct {
// Unit is the time unit type.
Unit TimeUnitType
// contains filtered or unexported fields
}
TimeUnitExpr is the expression for time unit.
func NewTimeUnitExpr ¶
func NewTimeUnitExpr(unit TimeUnitType) *TimeUnitExpr
NewTimeUnitExpr creates a new TimeUnitExpr
func (*TimeUnitExpr) Accept ¶
func (n *TimeUnitExpr) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*TimeUnitExpr) GetFlag ¶
func (en *TimeUnitExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*TimeUnitExpr) GetType ¶
func (en *TimeUnitExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*TimeUnitExpr) GetValue ¶
func (en *TimeUnitExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*TimeUnitExpr) SetFlag ¶
func (en *TimeUnitExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type TimeUnitType ¶
type TimeUnitType int
TimeUnitType is the type for time unit.
const ( TimeUnitInvalid TimeUnitType = iota TimeUnitMicrosecond TimeUnitSecond TimeUnitMinute TimeUnitHour TimeUnitDay TimeUnitWeek TimeUnitMonth TimeUnitQuarter TimeUnitYear TimeUnitSecondMicrosecond TimeUnitMinuteMicrosecond TimeUnitMinuteSecond TimeUnitHourMicrosecond TimeUnitHourSecond TimeUnitHourMinute TimeUnitDayMicrosecond TimeUnitDaySecond TimeUnitDayMinute TimeUnitDayHour TimeUnitYearMonth )
TimeUnit constants.
func (TimeUnitType) String ¶
func (t TimeUnitType) String() string
String returns the string representation of TimeUnitType.
type TrimDirectionExpr ¶
type TrimDirectionExpr struct {
// Direction is the trim direction type.
Direction TrimDirectionType
// contains filtered or unexported fields
}
TrimDirectionExpr is the expression for trim direction.
func NewTrimDirectionExpr ¶
func NewTrimDirectionExpr(direction TrimDirectionType) *TrimDirectionExpr
NewTrimDirectionExpr creates a new TrimDirectionExpr
func (*TrimDirectionExpr) Accept ¶
func (n *TrimDirectionExpr) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*TrimDirectionExpr) GetFlag ¶
func (en *TrimDirectionExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*TrimDirectionExpr) GetType ¶
func (en *TrimDirectionExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*TrimDirectionExpr) GetValue ¶
func (en *TrimDirectionExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*TrimDirectionExpr) SetFlag ¶
func (en *TrimDirectionExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type TrimDirectionType ¶
type TrimDirectionType int
TrimDirectionType is the type for trim direction.
const ( TrimBothDefault TrimDirectionType = iota TrimBoth TrimLeading TrimTrailing )
TrimDirection constants.
func (TrimDirectionType) String ¶
func (t TrimDirectionType) String() string
String returns the string representation of TrimDirectionType.
type TruncateTableStmt ¶
type TruncateTableStmt struct {
Table *TableName
// contains filtered or unexported fields
}
TruncateTableStmt is a statement to truncate a table.
type UnaryOperationExpr ¶
type UnaryOperationExpr struct {
// Op is the operator opcode.
Op Op
// V is the unary expression.
V ExprNode
// contains filtered or unexported fields
}
UnaryOperationExpr is the expression for unary operator.
func NewUnaryOperation ¶
func NewUnaryOperation(op Op, v ExprNode) *UnaryOperationExpr
NewUnaryOperation creates a new UnaryOperationExpr
func (*UnaryOperationExpr) Accept ¶
func (uoe *UnaryOperationExpr) Accept(visitor Visitor) (Node, bool)
Accept implements Node interface
func (*UnaryOperationExpr) GetFlag ¶
func (en *UnaryOperationExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*UnaryOperationExpr) GetType ¶
func (en *UnaryOperationExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*UnaryOperationExpr) GetValue ¶
func (en *UnaryOperationExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*UnaryOperationExpr) SetFlag ¶
func (en *UnaryOperationExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type UnlockTablesStmt ¶
type UnlockTablesStmt struct {
// contains filtered or unexported fields
}
UnlockTablesStmt is a statement to unlock tables.
type UpdateStmt ¶
type UpdateStmt struct {
// TableRefs is the table references.
TableRefs *TableRefsClause
// List is the assignment list.
List []*Assignment
// Where is the where clause.
Where ExprNode
// Order is the order by clause.
Order *OrderByClause
// Limit is the limit clause.
Limit *Limit
// LowPriority indicates low priority.
LowPriority bool
// IgnoreErr indicates ignore errors.
IgnoreErr bool
// MultipleTable indicates multiple tables update.
MultipleTable bool
// PartitionNames is the partition names.
PartitionNames []CIStr
// With is the with clause.
With *WithClause
// contains filtered or unexported fields
}
UpdateStmt is a statement to update columns of existing rows in tables with new values.
type UseStmt ¶
type UseStmt struct {
DBName string
// contains filtered or unexported fields
}
UseStmt is a statement to use database.
type UserSpec ¶
type UserSpec struct {
User string
Host string
AuthOpt *AuthOption
}
UserSpec represents a user specification.
type ValueExpr ¶
type ValueExpr struct {
Datum
// contains filtered or unexported fields
}
ValueExpr represents a value expression. Similar to TiDB's ValueExpr which embeds types.Datum.
func (*ValueExpr) GetFlag ¶
func (en *ValueExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*ValueExpr) GetType ¶
func (en *ValueExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*ValueExpr) SetFlag ¶
func (en *ValueExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type ValuesExpr ¶
type ValuesExpr struct {
// Column is column name.
Column *ColumnNameExpr
// contains filtered or unexported fields
}
ValuesExpr is the expression used in INSERT VALUES.
func NewValuesExpr ¶
func NewValuesExpr(column *ColumnNameExpr) *ValuesExpr
NewValuesExpr creates a new ValuesExpr
func (*ValuesExpr) Accept ¶
func (n *ValuesExpr) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*ValuesExpr) GetFlag ¶
func (en *ValuesExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*ValuesExpr) GetType ¶
func (en *ValuesExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*ValuesExpr) GetValue ¶
func (en *ValuesExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*ValuesExpr) SetFlag ¶
func (en *ValuesExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type VariableAssignment ¶
type VariableAssignment struct {
Name string
Value ExprNode
IsInstance bool
IsGlobal bool
IsSystem bool
// ExtendValue is a way to store extended info.
ExtendValue ExprNode
// contains filtered or unexported fields
}
VariableAssignment is variable assignment.
func (*VariableAssignment) Accept ¶
func (n *VariableAssignment) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*VariableAssignment) OriginTextPosition ¶
func (n *VariableAssignment) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*VariableAssignment) OriginalText ¶
func (n *VariableAssignment) OriginalText() string
OriginalText implements Node interface
func (*VariableAssignment) SetOriginTextPosition ¶
func (n *VariableAssignment) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type VariableExpr ¶
type VariableExpr struct {
// Name is the variable name.
Name string
// IsGlobal indicates whether this variable is global.
IsGlobal bool
// IsInstance indicates whether this variable is instance.
IsInstance bool
// IsSystem indicates whether this variable is a system variable in current session.
IsSystem bool
// ExplicitScope indicates whether this variable scope is set explicitly.
ExplicitScope bool
// Value is the variable value.
Value ExprNode
// contains filtered or unexported fields
}
VariableExpr is the expression for variable.
func NewVariableExpr ¶
func NewVariableExpr(name string, isGlobal, isSystem bool) *VariableExpr
NewVariableExpr creates a new VariableExpr
func (*VariableExpr) Accept ¶
func (n *VariableExpr) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*VariableExpr) GetFlag ¶
func (en *VariableExpr) GetFlag() uint64
GetFlag implements ExprNode interface
func (*VariableExpr) GetType ¶
func (en *VariableExpr) GetType() *FieldType
GetType implements ExprNode interface
func (*VariableExpr) GetValue ¶
func (en *VariableExpr) GetValue() interface{}
GetValue implements ExprNode interface
func (*VariableExpr) SetFlag ¶
func (en *VariableExpr) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type ViewAlgorithm ¶
type ViewAlgorithm int
ViewAlgorithm is VIEW algorithms.
const ( AlgorithmUndefined ViewAlgorithm = iota AlgorithmMerge AlgorithmTemptable )
View algorithms.
type ViewCheckOption ¶
type ViewCheckOption int
ViewCheckOption is VIEW CHECK OPTION.
const ( CheckOptionLocal ViewCheckOption = iota CheckOptionCascaded )
View check options.
type ViewSecurity ¶
type ViewSecurity int
ViewSecurity is VIEW security types.
const ( SecurityDefiner ViewSecurity = iota SecurityInvoker )
View security types.
type Visitor ¶
type Visitor interface {
// Enter is called before visiting a node
Enter(node Node) (Node, bool)
// Leave is called after visiting a node
Leave(node Node) (Node, bool)
}
Visitor is the interface for AST visitors
type WhenClause ¶
WhenClause represents a WHEN clause in CASE expression
func NewWhenClause ¶
func NewWhenClause(expr, result ExprNode) *WhenClause
NewWhenClause creates a new WhenClause
func (*WhenClause) Accept ¶
func (wc *WhenClause) Accept(visitor Visitor) (Node, bool)
Accept implements Node interface for WhenClause
func (*WhenClause) GetFlag ¶
func (en *WhenClause) GetFlag() uint64
GetFlag implements ExprNode interface
func (*WhenClause) GetType ¶
func (en *WhenClause) GetType() *FieldType
GetType implements ExprNode interface
func (*WhenClause) GetValue ¶
func (en *WhenClause) GetValue() interface{}
GetValue implements ExprNode interface
func (*WhenClause) SetFlag ¶
func (en *WhenClause) SetFlag(flag uint64)
SetFlag implements ExprNode interface
type WildCardField ¶
WildCardField is a special type of select field content.
func (*WildCardField) Accept ¶
func (n *WildCardField) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*WildCardField) OriginTextPosition ¶
func (n *WildCardField) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*WildCardField) OriginalText ¶
func (n *WildCardField) OriginalText() string
OriginalText implements Node interface
func (*WildCardField) SetOriginTextPosition ¶
func (n *WildCardField) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type WindowFuncExpr ¶
type WindowFuncExpr struct {
// Name is the function name.
Name string
// Args is the function args.
Args []ExprNode
// Distinct cannot be true for most window functions, except `max` and `min`.
Distinct bool
// IgnoreNull indicates how to handle null value.
IgnoreNull bool
// FromLast indicates the calculation direction of this window function.
FromLast bool
// Spec is the specification of this window.
Spec WindowSpec
// contains filtered or unexported fields
}
WindowFuncExpr represents window function expression.
func NewWindowFuncExpr ¶
func NewWindowFuncExpr(name string, args []ExprNode, spec WindowSpec) *WindowFuncExpr
NewWindowFuncExpr creates a new WindowFuncExpr
type WindowSpec ¶
type WindowSpec struct {
Name CIStr
// Ref is the reference window of this specification.
Ref CIStr
PartitionBy *PartitionByClause
OrderBy *OrderByClause
Frame *FrameClause
// OnlyAlias indicates whether this is only an alias.
OnlyAlias bool
// contains filtered or unexported fields
}
WindowSpec represents window specification.
func (*WindowSpec) Accept ¶
func (n *WindowSpec) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*WindowSpec) OriginTextPosition ¶
func (n *WindowSpec) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*WindowSpec) OriginalText ¶
func (n *WindowSpec) OriginalText() string
OriginalText implements Node interface
func (*WindowSpec) SetOriginTextPosition ¶
func (n *WindowSpec) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface
type WithClause ¶
type WithClause struct {
IsRecursive bool
CTEs []*CommonTableExpression
// contains filtered or unexported fields
}
WithClause represents WITH clause.
func (*WithClause) Accept ¶
func (n *WithClause) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*WithClause) OriginTextPosition ¶
func (n *WithClause) OriginTextPosition() int
OriginTextPosition implements Node interface
func (*WithClause) OriginalText ¶
func (n *WithClause) OriginalText() string
OriginalText implements Node interface
func (*WithClause) SetOriginTextPosition ¶
func (n *WithClause) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface