plan

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2022 License: Apache-2.0 Imports: 20 Imported by: 4

Documentation

Index

Constants

View Source
const (
	ShardTypeUnshard = "unshard"
	ShardTypeShard   = "shard"
)

constants of ShardType

Variables

This section is empty.

Functions

func GenerateSelectResultRowData

func GenerateSelectResultRowData(r *mysql.Result) error

GenerateSelectResultRowData generate raw RowData from values 根据value反向构造RowData copy from server.buildResultset()

func HandleDeletePlan

func HandleDeletePlan(p *DeletePlan) error

HandleDeletePlan build a DeletePlan

func HandleInsertStmt

func HandleInsertStmt(p *InsertPlan, stmt *ast.InsertStmt) error

HandleInsertStmt build a InsertPlan

func HandleSelectStmt

func HandleSelectStmt(p *SelectPlan, stmt *ast.SelectStmt) error

HandleSelectStmt build a SelectPlan 处理SelectStmt语法树, 改写其中一些节点, 并获取路由信息和结果聚合函数

func HandleUpdatePlan

func HandleUpdatePlan(p *UpdatePlan) error

HandleUpdatePlan build a UpdatePlan

func IsSelectLastInsertIDStmt

func IsSelectLastInsertIDStmt(stmt ast.StmtNode) bool

IsSelectLastInsertIDStmt check if the statement is SELECT LAST_INSERT_ID()

func MergeExecResult

func MergeExecResult(rs []*mysql.Result) (*mysql.Result, error)

MergeExecResult merge execution results, like UPDATE, INSERT, DELETE, ...

func MergeSelectResult

func MergeSelectResult(p *SelectPlan, stmt *ast.SelectStmt, rs []*mysql.Result) (*mysql.Result, error)

MergeSelectResult merge select results

func NeedCreateBetweenExprDecorator

func NeedCreateBetweenExprDecorator(p *TableAliasStmtInfo, n *ast.BetweenExpr) (router.Rule, bool, bool, error)

NeedCreateBetweenExprDecorator check if BetweenExpr needs decoration

func NeedCreateColumnNameExprDecoratorInCondition

func NeedCreateColumnNameExprDecoratorInCondition(p *TableAliasStmtInfo, n *ast.ColumnNameExpr) (router.Rule, bool, bool, error)

NeedCreateColumnNameExprDecoratorInCondition check if ColumnNameExpr in condition needs decoration 用于JOIN ON条件或WHERE条件中判断列名是否需要装饰 与上面的区别在于, 当只存在列名, 不存在db名和表名时, 还会根据列名去查找对应的条件 (因为装饰之后需要在比较条件中计算路由)

func NeedCreateColumnNameExprDecoratorInField

func NeedCreateColumnNameExprDecoratorInField(p *TableAliasStmtInfo, n *ast.ColumnNameExpr) (router.Rule, bool, bool, error)

NeedCreateColumnNameExprDecoratorInField check if ColumnNameExpr in field needs decoration 用于Field列表中判断列名是否需要装饰 如果db名和表名都不存在, 则不需要装饰

func NeedCreatePatternInExprDecorator

func NeedCreatePatternInExprDecorator(p *TableAliasStmtInfo, n *ast.PatternInExpr) (router.Rule, bool, bool, error)

NeedCreatePatternInExprDecorator check if PatternInExpr needs decoration

func NeedCreateTableNameDecorator

func NeedCreateTableNameDecorator(p *TableAliasStmtInfo, n *ast.TableName, alias string) (router.Rule, bool, error)

NeedCreateTableNameDecorator check if TableName with alias needs decorate SELECT语句可能带有表别名, 需要记录表别名

func NeedCreateTableNameDecoratorWithoutAlias

func NeedCreateTableNameDecoratorWithoutAlias(p *StmtInfo, n *ast.TableName) (router.Rule, bool, error)

NeedCreateTableNameDecoratorWithoutAlias check if TableName without alias needs decorate 不带表别名时, 只用StmtInfo就可以判断

func NeedRewriteLimitOrCreateRewrite

func NeedRewriteLimitOrCreateRewrite(stmt *ast.SelectStmt) (bool, int64, int64, *ast.Limit)

NeedRewriteLimitOrCreateRewrite check if SelectStmt need rewrite limit clause, if need, create a rewritten limit clause. count == -1代表没有Limit子句

Types

type AggregateFuncCountMerger

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

AggregateFuncCountMerger merge COUNT() column in result

func (*AggregateFuncCountMerger) MergeTo

func (a *AggregateFuncCountMerger) MergeTo(from, to ResultRow) error

MergeTo implement AggregateFuncMerger

type AggregateFuncMaxMerger

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

AggregateFuncMaxMerger merge MAX() column in result

func (*AggregateFuncMaxMerger) MergeTo

func (a *AggregateFuncMaxMerger) MergeTo(from, to ResultRow) error

MergeTo implement AggregateFuncMerger

type AggregateFuncMerger

type AggregateFuncMerger interface {
	// MergeTo 合并结果集, from为待合并行, to为结果聚合行
	MergeTo(from, to ResultRow) error
}

AggregateFuncMerger is the merger of aggregate function

func CreateAggregateFunctionMerger

func CreateAggregateFunctionMerger(funcType string, fieldIndex int) (AggregateFuncMerger, error)

CreateAggregateFunctionMerger create AggregateFunctionMerger by function type currently support: "count", "sum", "max", "min"

type AggregateFuncMinMerger

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

AggregateFuncMinMerger merge MIN() column in result

func (*AggregateFuncMinMerger) MergeTo

func (a *AggregateFuncMinMerger) MergeTo(from, to ResultRow) error

MergeTo implement AggregateFuncMerger

type AggregateFuncSumMerger

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

AggregateFuncSumMerger merge SUM() column in result

func (*AggregateFuncSumMerger) MergeTo

func (a *AggregateFuncSumMerger) MergeTo(from, to ResultRow) error

MergeTo implement AggregateFuncMerger

type BetweenExprDecorator

type BetweenExprDecorator struct {
	*ast.BetweenExpr // origin
	// contains filtered or unexported fields
}

BetweenExprDecorator decorate BetweenExpr Between只需要改写表名并计算路由, 不需要改写边界值.

func CreateBetweenExprDecorator

func CreateBetweenExprDecorator(n *ast.BetweenExpr, rule router.Rule, isAlias bool, result *RouteResult) (*BetweenExprDecorator, error)

CreateBetweenExprDecorator create BetweenExprDecorator

func (*BetweenExprDecorator) Accept

func (b *BetweenExprDecorator) Accept(v ast.Visitor) (ast.Node, bool)

Accept do nothing and return current decorator

func (*BetweenExprDecorator) GetCurrentRouteResult

func (b *BetweenExprDecorator) GetCurrentRouteResult() []int

GetCurrentRouteResult return route result

func (*BetweenExprDecorator) Restore

func (b *BetweenExprDecorator) Restore(ctx *format.RestoreCtx) error

Restore column name restore is different from BetweenExpr

type BinaryOperationFieldtype

type BinaryOperationFieldtype int

BinaryOperationFieldtype declares field type of binary operation

const (
	UnsupportExpr BinaryOperationFieldtype = iota
	ValueExpr
	ColumnNameExpr
	FuncCallExpr
)

Expr type

type Checker

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

Checker 用于检查SelectStmt是不是分表的Visitor, 以及是否包含DB信息

func NewChecker

func NewChecker(db string, router *router.Router) *Checker

NewChecker db为USE db中设置的DB名. 如果没有执行USE db, 则为空字符串

func (*Checker) Enter

func (s *Checker) Enter(n ast.Node) (node ast.Node, skipChildren bool)

Enter for node visit

func (*Checker) GetUnshardTableNames added in v1.0.3

func (s *Checker) GetUnshardTableNames() []*ast.TableName

func (*Checker) IsDatabaseInvalid

func (s *Checker) IsDatabaseInvalid() bool

IsDatabaseInvalid 判断执行计划中是否包含db信息, 如果不包含, 且又含有表名, 则是一个错的执行计划, 应该返回以下错误: ERROR 1046 (3D000): No database selected

func (*Checker) IsShard

func (s *Checker) IsShard() bool

IsShard if is shard table

func (*Checker) Leave

func (s *Checker) Leave(n ast.Node) (node ast.Node, ok bool)

Leave for node visit

type ColumnNameDecorator

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

ColumnNameDecorator decorate ColumnName to rewrite table name

func (*ColumnNameDecorator) Accept

func (c *ColumnNameDecorator) Accept(v ast.Visitor) (ast.Node, bool)

Accept implement ast.Node do nothing and return current decorator

func (*ColumnNameDecorator) GetColumnInfo

func (c *ColumnNameDecorator) GetColumnInfo() (string, string, string)

GetColumnInfo get column info, return db, table, column

func (*ColumnNameDecorator) Restore

func (c *ColumnNameDecorator) Restore(ctx *format.RestoreCtx) error

Restore implement ast.Node

func (*ColumnNameDecorator) SetText

func (c *ColumnNameDecorator) SetText(text string)

SetText implement ast.Node

func (*ColumnNameDecorator) Text

func (c *ColumnNameDecorator) Text() string

Text implement ast.Node

type ColumnNameExprDecorator

type ColumnNameExprDecorator struct {
	*ast.ColumnNameExpr
	Name *ColumnNameDecorator
}

ColumnNameExprDecorator decorate ColumnNameExpr to rewrite table name

func CreateColumnNameExprDecorator

func CreateColumnNameExprDecorator(n *ast.ColumnNameExpr, rule router.Rule, isAlias bool, result *RouteResult) *ColumnNameExprDecorator

CreateColumnNameExprDecorator create ColumnNameExprDecorator

func (*ColumnNameExprDecorator) Restore

func (cc *ColumnNameExprDecorator) Restore(ctx *format.RestoreCtx) error

Restore implement ast.Node

type ColumnNameRewriteVisitor

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

ColumnNameRewriteVisitor visit ColumnNameExpr, check if need decorate, and then decorate it.

func NewColumnNameRewriteVisitor

func NewColumnNameRewriteVisitor(p *TableAliasStmtInfo) *ColumnNameRewriteVisitor

NewColumnNameRewriteVisitor constructor of ColumnNameRewriteVisitor

func (*ColumnNameRewriteVisitor) Enter

func (s *ColumnNameRewriteVisitor) Enter(n ast.Node) (node ast.Node, skipChildren bool)

Enter implement ast.Visitor

func (*ColumnNameRewriteVisitor) Leave

func (s *ColumnNameRewriteVisitor) Leave(n ast.Node) (node ast.Node, ok bool)

Leave implement ast.Visitor

type DeletePlan

type DeletePlan struct {
	*TableAliasStmtInfo
	// contains filtered or unexported fields
}

DeletePlan is the plan for delete statement

func NewDeletePlan

func NewDeletePlan(stmt *ast.DeleteStmt, db, sql string, r *router.Router) *DeletePlan

NewDeletePlan constructor of DeletePlan

func (*DeletePlan) ExecuteIn

func (p *DeletePlan) ExecuteIn(reqCtx *util.RequestContext, sess Executor) (*mysql.Result, error)

ExecuteIn implement Plan

func (*DeletePlan) Size

func (*DeletePlan) Size() int

type Executor

type Executor interface {

	// 执行分片或非分片单条SQL
	ExecuteSQL(ctx *util.RequestContext, slice, db, sql string) (*mysql.Result, error)

	// 执行分片SQL
	ExecuteSQLs(*util.RequestContext, map[string]map[string][]string) ([]*mysql.Result, error)

	// 用于执行INSERT时设置last insert id
	SetLastInsertID(uint64)

	GetLastInsertID() uint64
}

Executor TODO: move to package executor

type ExplainPlan

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

ExplainPlan is the plan for explain statement

func (*ExplainPlan) ExecuteIn

ExecuteIn implement Plan

func (*ExplainPlan) Size

func (p *ExplainPlan) Size() int

Size implement Plan

type InsertPlan

type InsertPlan struct {
	*StmtInfo
	// contains filtered or unexported fields
}

InsertPlan is the plan for insert statement

func NewInsertPlan

func NewInsertPlan(db string, sql string, r *router.Router, seq *sequence.SequenceManager) *InsertPlan

NewInsertPlan constructor of InsertPlan

func (*InsertPlan) ExecuteIn

func (s *InsertPlan) ExecuteIn(reqCtx *util.RequestContext, sess Executor) (*mysql.Result, error)

ExecuteIn implement Plan

func (*InsertPlan) GetStmt

func (s *InsertPlan) GetStmt() *ast.InsertStmt

GetStmt return InsertStmt

func (*InsertPlan) Size

func (*InsertPlan) Size() int

type PatternInExprDecorator

type PatternInExprDecorator struct {
	Expr ast.ExprNode
	List []ast.ExprNode
	Not  bool
	// contains filtered or unexported fields
}

PatternInExprDecorator decorate PatternInExpr 这里记录tableIndexes和indexValueMap是没有问题的, 因为如果是OR条件, 导致路由索引[]int变宽, 改写的SQL只是IN这一项没有值, 并不会影响SQL正确性和执行结果.

func CreatePatternInExprDecorator

func CreatePatternInExprDecorator(n *ast.PatternInExpr, rule router.Rule, isAlias bool, result *RouteResult) (*PatternInExprDecorator, error)

CreatePatternInExprDecorator create PatternInExprDecorator 必须先检查是否需要装饰

func (*PatternInExprDecorator) Accept

func (p *PatternInExprDecorator) Accept(v ast.Visitor) (node ast.Node, ok bool)

Accept implement ast.Node

func (*PatternInExprDecorator) Format

func (p *PatternInExprDecorator) Format(w io.Writer)

Format implement ast.ExprNode

func (*PatternInExprDecorator) GetCurrentRouteResult

func (p *PatternInExprDecorator) GetCurrentRouteResult() []int

GetCurrentRouteResult get route result of current decorator

func (*PatternInExprDecorator) GetFlag

func (p *PatternInExprDecorator) GetFlag() uint64

GetFlag implement ast.ExprNode

func (*PatternInExprDecorator) GetType

func (p *PatternInExprDecorator) GetType() *types.FieldType

GetType implement ast.ExprNode

func (*PatternInExprDecorator) Restore

func (p *PatternInExprDecorator) Restore(ctx *format.RestoreCtx) error

Restore implement ast.Node

func (*PatternInExprDecorator) SetFlag

func (p *PatternInExprDecorator) SetFlag(flag uint64)

SetFlag implement ast.ExprNode

func (*PatternInExprDecorator) SetText

func (p *PatternInExprDecorator) SetText(text string)

SetText implement ast.Node

func (*PatternInExprDecorator) SetType

func (p *PatternInExprDecorator) SetType(tp *types.FieldType)

SetType implement ast.ExprNode

func (*PatternInExprDecorator) Text

func (p *PatternInExprDecorator) Text() string

Text implement ast.Node

type Plan

type Plan interface {
	ExecuteIn(*util.RequestContext, Executor) (*mysql.Result, error)

	// only for cache
	Size() int
}

Plan is a interface for select/insert etc.

func BuildPlan

func BuildPlan(stmt ast.StmtNode, phyDBs map[string]string, db, sql string, router *router.Router, seq *sequence.SequenceManager) (Plan, error)

BuildPlan build plan for ast

type ResultRow

type ResultRow []interface{}

ResultRow is one Row in Result

func (ResultRow) GetFloat

func (r ResultRow) GetFloat(column int) (float64, error)

GetFloat get float64 value from column

func (ResultRow) GetInt

func (r ResultRow) GetInt(column int) (int64, error)

GetInt get int value from column copy from Resultset.GetInt()

func (ResultRow) GetUint

func (r ResultRow) GetUint(column int) (uint64, error)

GetUint get uint64 value from column

func (ResultRow) GetValue

func (r ResultRow) GetValue(column int) interface{}

GetValue get value from column

func (ResultRow) SetValue

func (r ResultRow) SetValue(column int, value interface{})

SetValue set value to column

type RouteResult

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

RouteResult is the route result of a statement 遍历AST之后得到的路由结果 db, table唯一确定了一个路由, 这里只记录分片表的db和table, 如果是关联表, 必须关联到同一个父表

func NewRouteResult

func NewRouteResult(db, table string, initIndexes []int) *RouteResult

NewRouteResult constructor of RouteResult

func (*RouteResult) Check

func (r *RouteResult) Check(db, table string) error

Check check if the db and table is valid

func (*RouteResult) GetCurrentTableIndex

func (r *RouteResult) GetCurrentTableIndex() (int, error)

GetCurrentTableIndex get current table index

func (*RouteResult) GetShardIndexes

func (r *RouteResult) GetShardIndexes() []int

GetShardIndexes get shard indexes

func (*RouteResult) HasNext

func (r *RouteResult) HasNext() bool

HasNext check if has next index

func (*RouteResult) Inter

func (r *RouteResult) Inter(indexes []int)

Inter inter indexes with origin indexes in RouteResult 如果是关联表, db, table需要用父表的db和table

func (*RouteResult) Next

func (r *RouteResult) Next() int

Next get next table index

func (*RouteResult) Reset

func (r *RouteResult) Reset()

Reset reset the cursor of index

func (*RouteResult) Union

func (r *RouteResult) Union(indexes []int)

Union union indexes with origin indexes in RouteResult 如果是关联表, db, table需要用父表的db和table

type SelectLastInsertIDPlan

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

SelectLastInsertIDPlan is the plan for SELECT LAST_INSERT_ID() TODO: fix below https://dev.mysql.com/doc/refman/5.6/en/information-functions.html#function_last-insert-id The value of LAST_INSERT_ID() is not changed if you set the AUTO_INCREMENT column of a row to a non-“magic” value (that is, a value that is not NULL and not 0).

func CreateSelectLastInsertIDPlan

func CreateSelectLastInsertIDPlan() *SelectLastInsertIDPlan

CreateSelectLastInsertIDPlan constructor of SelectLastInsertIDPlan

func (*SelectLastInsertIDPlan) ExecuteIn

func (p *SelectLastInsertIDPlan) ExecuteIn(reqCtx *util.RequestContext, se Executor) (*mysql.Result, error)

ExecuteIn implement Plan

func (*SelectLastInsertIDPlan) Size

func (*SelectLastInsertIDPlan) Size() int

type SelectPlan

type SelectPlan struct {
	*TableAliasStmtInfo
	// contains filtered or unexported fields
}

SelectPlan is the plan for select statement

func NewSelectPlan

func NewSelectPlan(db string, sql string, r *router.Router) *SelectPlan

NewSelectPlan constructor of SelectPlan db is the session db

func (*SelectPlan) ExecuteIn

func (s *SelectPlan) ExecuteIn(reqCtx *util.RequestContext, sess Executor) (*mysql.Result, error)

ExecuteIn implement Plan

func (*SelectPlan) GetColumnCount

func (s *SelectPlan) GetColumnCount() int

GetColumnCount get column count with extra columns

func (*SelectPlan) GetGroupByColumnInfo

func (s *SelectPlan) GetGroupByColumnInfo() []int

GetGroupByColumnInfo get extra column offset and length for group by

func (*SelectPlan) GetLimitValue

func (s *SelectPlan) GetLimitValue() (int64, int64)

GetLimitValue get offset, count in limit clause

func (*SelectPlan) GetOrderByColumnInfo

func (s *SelectPlan) GetOrderByColumnInfo() ([]int, []bool)

GetOrderByColumnInfo get extra column offset and length for order by

func (*SelectPlan) GetOriginColumnCount

func (s *SelectPlan) GetOriginColumnCount() int

GetOriginColumnCount get origin column count in statement, since group by and order by may add extra columns to FieldList.

func (*SelectPlan) GetSQLs

func (s *SelectPlan) GetSQLs() map[string]map[string][]string

GetSQLs get generated SQLs the first key is slice, the second key is backend database name, the value is sql list.

func (*SelectPlan) GetStmt

func (s *SelectPlan) GetStmt() *ast.SelectStmt

GetStmt SelectStmt

func (*SelectPlan) HasGroupBy

func (s *SelectPlan) HasGroupBy() bool

HasGroupBy if the select statement has group by clause, return true

func (*SelectPlan) HasLimit

func (s *SelectPlan) HasLimit() bool

HasLimit if the select statement has limit clause, return true

func (*SelectPlan) HasOrderBy

func (s *SelectPlan) HasOrderBy() bool

HasOrderBy if select statement has order by clause, return true

func (*SelectPlan) Size

func (*SelectPlan) Size() int

type StmtInfo

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

StmtInfo 各种Plan的一些公共属性

func NewStmtInfo

func NewStmtInfo(db string, sql string, r *router.Router) *StmtInfo

NewStmtInfo constructor of StmtInfo

func (*StmtInfo) GetRouteResult

func (s *StmtInfo) GetRouteResult() *RouteResult

GetRouteResult get route result

func (*StmtInfo) RecordShardTable

func (s *StmtInfo) RecordShardTable(db, table string) (router.Rule, error)

RecordShardTable 将表信息记录到StmtInfo中, 并返回表信息对应的路由规则

type SubqueryColumnNameRewriteVisitor

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

SubqueryColumnNameRewriteVisitor visit ColumnNameExpr in subquery, check if need decorate, and then decorate it.

func NewSubqueryColumnNameRewriteVisitor

func NewSubqueryColumnNameRewriteVisitor(p *TableAliasStmtInfo) *SubqueryColumnNameRewriteVisitor

NewSubqueryColumnNameRewriteVisitor consturctor of SubqueryColumnNameRewriteVisitor

func (*SubqueryColumnNameRewriteVisitor) Enter

func (s *SubqueryColumnNameRewriteVisitor) Enter(n ast.Node) (node ast.Node, skipChildren bool)

Enter implement ast.Visitor

func (*SubqueryColumnNameRewriteVisitor) Leave

func (s *SubqueryColumnNameRewriteVisitor) Leave(n ast.Node) (node ast.Node, ok bool)

Leave implement ast.Visitor

type TableAliasStmtInfo

type TableAliasStmtInfo struct {
	*StmtInfo
	// contains filtered or unexported fields
}

TableAliasStmtInfo 使用到表别名, 且依赖表别名做路由计算的StmtNode, 目前包括UPDATE, SELECT INSERT也可以使用表别名, 但是由于只存在一个表, 可以直接去掉, 因此不需要.

func NewTableAliasStmtInfo

func NewTableAliasStmtInfo(db string, sql string, r *router.Router) *TableAliasStmtInfo

NewTableAliasStmtInfo means table alias StmtInfo

func (*TableAliasStmtInfo) GetSettedRuleFromColumnInfo

func (t *TableAliasStmtInfo) GetSettedRuleFromColumnInfo(db, table, column string) (router.Rule, bool, bool, error)

GetSettedRuleFromColumnInfo 用于WHERE条件或JOIN ON条件中, 查找列名对应的路由规则

func (*TableAliasStmtInfo) RecordShardTable

func (t *TableAliasStmtInfo) RecordShardTable(db, table, alias string) (router.Rule, error)

RecordShardTable 将表信息记录到StmtInfo中, 并返回表信息对应的路由规则

func (*TableAliasStmtInfo) RecordSubqueryTableAlias

func (t *TableAliasStmtInfo) RecordSubqueryTableAlias(alias string) (router.Rule, error)

RecordSubqueryTableAlias 记录表名位置的子查询的别名, 便于后续处理 返回已存在Rule的第一个 (任意一个即可) 限制: 子查询中的表对应的路由规则必须与外层查询相关联, 或者为全局表

type TableNameDecorator

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

TableNameDecorator decorate TableName

func CreateTableNameDecorator

func CreateTableNameDecorator(n *ast.TableName, rule router.Rule, result *RouteResult) (*TableNameDecorator, error)

CreateTableNameDecorator create TableNameDecorator the table has been checked before

func (*TableNameDecorator) Accept

func (t *TableNameDecorator) Accept(v ast.Visitor) (ast.Node, bool)

Accept implement ast.Node do nothing and return current decorator

func (*TableNameDecorator) Restore

func (t *TableNameDecorator) Restore(ctx *format.RestoreCtx) error

Restore implement ast.Node

func (*TableNameDecorator) SetText

func (t *TableNameDecorator) SetText(text string)

SetText implement ast.Node

func (*TableNameDecorator) Text

func (t *TableNameDecorator) Text() string

Text implement ast.Node

type UnshardPlan

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

UnshardPlan is the plan for unshard statement

func CreateUnshardPlan

func CreateUnshardPlan(stmt ast.StmtNode, phyDBs map[string]string, db string, tableNames []*ast.TableName) (*UnshardPlan, error)

CreateUnshardPlan constructor of UnshardPlan

func (*UnshardPlan) ExecuteIn

func (p *UnshardPlan) ExecuteIn(reqCtx *util.RequestContext, se Executor) (*mysql.Result, error)

ExecuteIn implement Plan

func (*UnshardPlan) Size

func (*UnshardPlan) Size() int

type UpdatePlan

type UpdatePlan struct {
	*TableAliasStmtInfo
	// contains filtered or unexported fields
}

UpdatePlan is the plan for update statement

func NewUpdatePlan

func NewUpdatePlan(stmt *ast.UpdateStmt, db, sql string, r *router.Router) *UpdatePlan

NewUpdatePlan constructor of UpdatePlan

func (*UpdatePlan) ExecuteIn

func (s *UpdatePlan) ExecuteIn(reqCtx *util.RequestContext, sess Executor) (*mysql.Result, error)

ExecuteIn implement Plan

func (*UpdatePlan) Size

func (*UpdatePlan) Size() int

Jump to

Keyboard shortcuts

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