Documentation ¶
Index ¶
- Variables
- func Hints(tableName ast.TableName, hints []*hint.Hint, rule *rule.Rule) (hintTables rule.DatabaseTables, err error)
- func IsDenyFullScanErr(err error) bool
- func IsNoRuleFoundErr(err error) bool
- func IsNoShardKeyFoundErr(err error) bool
- func NewOptimizer(rule *rule.Rule, hints []*hint.Hint, stmt ast.StmtNode, args []proto.Value) (proto.Optimizer, error)
- func Register(t rast.SQLType, h Processor)
- func RegisterHint(t hint.Type, h HintExecutor)
- type Calculus
- type CustomRoute
- type Direct
- type HintExecutor
- type Optimizer
- type Processor
- type ShardVisitor
- func (sd *ShardVisitor) ForSingleSelect(table ast.TableName, alias string, where ast.ExpressionNode) error
- func (sd *ShardVisitor) Result() []misc.Pair[ast.TableName, *rule.Shards]
- func (sd *ShardVisitor) SimpleShard(table ast.TableName, where ast.ExpressionNode) (rule.DatabaseTables, error)
- func (sd *ShardVisitor) VisitAtomColumn(_ ast.ColumnNameExpressionAtom) (interface{}, error)
- func (sd *ShardVisitor) VisitAtomConstant(node *ast.ConstantExpressionAtom) (interface{}, error)
- func (sd *ShardVisitor) VisitAtomFunction(node *ast.FunctionCallExpressionAtom) (interface{}, error)
- func (sd *ShardVisitor) VisitAtomInterval(_ *ast.IntervalExpressionAtom) (interface{}, error)
- func (sd *ShardVisitor) VisitAtomMath(node *ast.MathExpressionAtom) (interface{}, error)
- func (sd *ShardVisitor) VisitAtomNested(node *ast.NestedExpressionAtom) (interface{}, error)
- func (sd *ShardVisitor) VisitAtomSystemVariable(_ *ast.SystemVariableExpressionAtom) (interface{}, error)
- func (sd *ShardVisitor) VisitAtomUnary(node *ast.UnaryExpressionAtom) (interface{}, error)
- func (sd *ShardVisitor) VisitAtomVariable(node ast.VariableExpressionAtom) (interface{}, error)
- func (sd *ShardVisitor) VisitLogicalExpression(node *ast.LogicalExpressionNode) (interface{}, error)
- func (sd *ShardVisitor) VisitNotExpression(node *ast.NotExpressionNode) (interface{}, error)
- func (sd *ShardVisitor) VisitPredicateAtom(node *ast.AtomPredicateNode) (interface{}, error)
- func (sd *ShardVisitor) VisitPredicateBetween(node *ast.BetweenPredicateNode) (interface{}, error)
- func (sd *ShardVisitor) VisitPredicateBinaryComparison(node *ast.BinaryComparisonPredicateNode) (interface{}, error)
- func (sd *ShardVisitor) VisitPredicateExpression(node *ast.PredicateExpressionNode) (interface{}, error)
- func (sd *ShardVisitor) VisitPredicateIn(node *ast.InPredicateNode) (interface{}, error)
- func (sd *ShardVisitor) VisitPredicateLike(node *ast.LikePredicateNode) (interface{}, error)
- func (sd *ShardVisitor) VisitPredicateRegexp(_ *ast.RegexpPredicationNode) (interface{}, error)
- func (sd *ShardVisitor) VisitSelectElementExpr(node *ast.SelectElementExpr) (interface{}, error)
- func (sd *ShardVisitor) VisitSelectStatement(node *ast.SelectStatement) (interface{}, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoRuleFound = errors.New("optimize: no rule found") ErrDenyFullScan = errors.New("optimize: the full-scan query is not allowed") ErrNoShardKeyFound = errors.New("optimize: no shard key found") )
errors group
View Source
var Tracer = otel.Tracer("optimize")
Functions ¶
func IsDenyFullScanErr ¶
IsDenyFullScanErr returns true if target error is caused by DENY-FULL-SCAN.
func IsNoRuleFoundErr ¶
IsNoRuleFoundErr returns true if target error is caused by NO-RULE-FOUND.
func IsNoShardKeyFoundErr ¶
IsNoShardKeyFoundErr returns true if target error is caused by NO-SHARD-KEY-FOUND
func NewOptimizer ¶
func RegisterHint ¶
func RegisterHint(t hint.Type, h HintExecutor)
RegisterHint register hint implementation.
Types ¶
type CustomRoute ¶
type CustomRoute struct{}
type HintExecutor ¶
type HintExecutor interface {
// contains filtered or unexported methods
}
type Optimizer ¶
func (*Optimizer) ComputeShards ¶
type ShardVisitor ¶
type ShardVisitor struct { ast.BaseVisitor // contains filtered or unexported fields }
func NewXSharder ¶
func (*ShardVisitor) ForSingleSelect ¶
func (sd *ShardVisitor) ForSingleSelect(table ast.TableName, alias string, where ast.ExpressionNode) error
func (*ShardVisitor) SimpleShard ¶
func (sd *ShardVisitor) SimpleShard(table ast.TableName, where ast.ExpressionNode) (rule.DatabaseTables, error)
func (*ShardVisitor) VisitAtomColumn ¶
func (sd *ShardVisitor) VisitAtomColumn(_ ast.ColumnNameExpressionAtom) (interface{}, error)
func (*ShardVisitor) VisitAtomConstant ¶
func (sd *ShardVisitor) VisitAtomConstant(node *ast.ConstantExpressionAtom) (interface{}, error)
func (*ShardVisitor) VisitAtomFunction ¶
func (sd *ShardVisitor) VisitAtomFunction(node *ast.FunctionCallExpressionAtom) (interface{}, error)
func (*ShardVisitor) VisitAtomInterval ¶
func (sd *ShardVisitor) VisitAtomInterval(_ *ast.IntervalExpressionAtom) (interface{}, error)
func (*ShardVisitor) VisitAtomMath ¶
func (sd *ShardVisitor) VisitAtomMath(node *ast.MathExpressionAtom) (interface{}, error)
func (*ShardVisitor) VisitAtomNested ¶
func (sd *ShardVisitor) VisitAtomNested(node *ast.NestedExpressionAtom) (interface{}, error)
func (*ShardVisitor) VisitAtomSystemVariable ¶
func (sd *ShardVisitor) VisitAtomSystemVariable(_ *ast.SystemVariableExpressionAtom) (interface{}, error)
func (*ShardVisitor) VisitAtomUnary ¶
func (sd *ShardVisitor) VisitAtomUnary(node *ast.UnaryExpressionAtom) (interface{}, error)
func (*ShardVisitor) VisitAtomVariable ¶
func (sd *ShardVisitor) VisitAtomVariable(node ast.VariableExpressionAtom) (interface{}, error)
func (*ShardVisitor) VisitLogicalExpression ¶
func (sd *ShardVisitor) VisitLogicalExpression(node *ast.LogicalExpressionNode) (interface{}, error)
func (*ShardVisitor) VisitNotExpression ¶
func (sd *ShardVisitor) VisitNotExpression(node *ast.NotExpressionNode) (interface{}, error)
func (*ShardVisitor) VisitPredicateAtom ¶
func (sd *ShardVisitor) VisitPredicateAtom(node *ast.AtomPredicateNode) (interface{}, error)
func (*ShardVisitor) VisitPredicateBetween ¶
func (sd *ShardVisitor) VisitPredicateBetween(node *ast.BetweenPredicateNode) (interface{}, error)
func (*ShardVisitor) VisitPredicateBinaryComparison ¶
func (sd *ShardVisitor) VisitPredicateBinaryComparison(node *ast.BinaryComparisonPredicateNode) (interface{}, error)
func (*ShardVisitor) VisitPredicateExpression ¶
func (sd *ShardVisitor) VisitPredicateExpression(node *ast.PredicateExpressionNode) (interface{}, error)
func (*ShardVisitor) VisitPredicateIn ¶
func (sd *ShardVisitor) VisitPredicateIn(node *ast.InPredicateNode) (interface{}, error)
func (*ShardVisitor) VisitPredicateLike ¶
func (sd *ShardVisitor) VisitPredicateLike(node *ast.LikePredicateNode) (interface{}, error)
func (*ShardVisitor) VisitPredicateRegexp ¶
func (sd *ShardVisitor) VisitPredicateRegexp(_ *ast.RegexpPredicationNode) (interface{}, error)
func (*ShardVisitor) VisitSelectElementExpr ¶
func (sd *ShardVisitor) VisitSelectElementExpr(node *ast.SelectElementExpr) (interface{}, error)
func (*ShardVisitor) VisitSelectStatement ¶
func (sd *ShardVisitor) VisitSelectStatement(node *ast.SelectStatement) (interface{}, error)
Click to show internal directories.
Click to hide internal directories.