Documentation ¶
Index ¶
- type ComplexCondition
- type Condition
- func And(alg ShardingAlgorithm, k1, k2 *KeyCondition) (Condition, error)
- func Or(alg ShardingAlgorithm, condition1, condition2 Condition) (Condition, error)
- func ParseBetweenCondition(expr *ast.BetweenExpr, args ...interface{}) (Condition, error)
- func ParseCompareExpression(expr *ast.BinaryOperationExpr, args ...interface{}) (Condition, error)
- func ParseCondition(cond ast.ExprNode, args ...interface{}) (Condition, error)
- func ParseInCondition(expr *ast.PatternInExpr, args ...interface{}) (Condition, error)
- func ParseLikeCondition(expr *ast.PatternLikeExpr, args ...interface{}) (Condition, error)
- func ParseLogicalCondition(expr *ast.BinaryOperationExpr, args ...interface{}) (Condition, error)
- func ParseMathCondition(expr *ast.BinaryOperationExpr, args ...interface{}) (Condition, error)
- func ParseValCondition(expr ast.ExprNode, args ...interface{}) (Condition, error)
- type ConditionShard
- type ConditionSlice
- type FalseCondition
- type KeyCondition
- type NumberMod
- func (shard *NumberMod) AllShards() Condition
- func (shard *NumberMod) AllowFullScan() bool
- func (shard *NumberMod) HasShardingKey(key string) bool
- func (shard *NumberMod) NextID() (int64, error)
- func (shard *NumberMod) Shard(condition *KeyCondition) (Condition, error)
- func (shard *NumberMod) ShardRange(cond1, cond2 *KeyCondition) (Condition, error)
- type NumberRange
- func (shard *NumberRange) AllShards() Condition
- func (shard *NumberRange) AllowFullScan() bool
- func (shard *NumberRange) HasShardingKey(key string) bool
- func (shard *NumberRange) NextID() (int64, error)
- func (shard *NumberRange) Shard(condition *KeyCondition) (Condition, error)
- func (shard *NumberRange) ShardRange(cond1, cond2 *KeyCondition) (Condition, error)
- type Range
- type ShardingAlgorithm
- type TableIndexSliceCondition
- type TrueCondition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComplexCondition ¶
func (*ComplexCondition) And ¶
func (cond *ComplexCondition) And(cond2 Condition) Condition
func (*ComplexCondition) Or ¶
func (cond *ComplexCondition) Or(cond2 Condition) Condition
func (*ComplexCondition) Shard ¶
func (cond *ComplexCondition) Shard(alg ShardingAlgorithm) (TableIndexSliceCondition, error)
type Condition ¶
func And ¶
func And(alg ShardingAlgorithm, k1, k2 *KeyCondition) (Condition, error)
And condition1, condition2 TrueCondition FalseCondition KeyCondition return TrueCondition FalseCondition TableIndexSliceCondition
func Or ¶
func Or(alg ShardingAlgorithm, condition1, condition2 Condition) (Condition, error)
Or condition1, condition2 TrueCondition FalseCondition KeyCondition return TrueCondition FalseCondition TableIndexSliceCondition
func ParseBetweenCondition ¶
func ParseBetweenCondition(expr *ast.BetweenExpr, args ...interface{}) (Condition, error)
func ParseCompareExpression ¶
func ParseCompareExpression(expr *ast.BinaryOperationExpr, args ...interface{}) (Condition, error)
func ParseCondition ¶
func ParseInCondition ¶
func ParseInCondition(expr *ast.PatternInExpr, args ...interface{}) (Condition, error)
func ParseLikeCondition ¶
func ParseLikeCondition(expr *ast.PatternLikeExpr, args ...interface{}) (Condition, error)
func ParseLogicalCondition ¶
func ParseLogicalCondition(expr *ast.BinaryOperationExpr, args ...interface{}) (Condition, error)
func ParseMathCondition ¶
func ParseMathCondition(expr *ast.BinaryOperationExpr, args ...interface{}) (Condition, error)
type ConditionShard ¶
type ConditionShard interface {
Shard(alg ShardingAlgorithm) (TableIndexSliceCondition, error)
}
type ConditionSlice ¶
type ConditionSlice []Condition
func (ConditionSlice) Len ¶
func (s ConditionSlice) Len() int
func (ConditionSlice) Less ¶
func (s ConditionSlice) Less(i, j int) bool
func (ConditionSlice) Swap ¶
func (s ConditionSlice) Swap(i, j int)
type FalseCondition ¶
type FalseCondition struct{}
func (FalseCondition) And ¶
func (cond FalseCondition) And(cond2 Condition) Condition
func (FalseCondition) Or ¶
func (cond FalseCondition) Or(cond2 Condition) Condition
func (FalseCondition) Shard ¶
func (cond FalseCondition) Shard(alg ShardingAlgorithm) (TableIndexSliceCondition, error)
type KeyCondition ¶
func (*KeyCondition) And ¶
func (cond *KeyCondition) And(cond2 Condition) Condition
func (*KeyCondition) Or ¶
func (cond *KeyCondition) Or(cond2 Condition) Condition
func (*KeyCondition) Shard ¶
func (cond *KeyCondition) Shard(alg ShardingAlgorithm) (TableIndexSliceCondition, error)
type NumberMod ¶
type NumberMod struct {
// contains filtered or unexported fields
}
func NewNumberMod ¶
func (*NumberMod) AllowFullScan ¶
func (*NumberMod) HasShardingKey ¶
func (*NumberMod) ShardRange ¶
func (shard *NumberMod) ShardRange(cond1, cond2 *KeyCondition) (Condition, error)
type NumberRange ¶ added in v0.5.0
type NumberRange struct {
// contains filtered or unexported fields
}
func NewNumberRange ¶ added in v0.5.0
func NewNumberRange(shardingKey string, allowFullScan bool, topology *topo.Topology, config map[string]interface{}, generator proto.SequenceGenerator) (*NumberRange, error)
func (*NumberRange) AllShards ¶ added in v0.5.0
func (shard *NumberRange) AllShards() Condition
func (*NumberRange) AllowFullScan ¶ added in v0.5.0
func (shard *NumberRange) AllowFullScan() bool
func (*NumberRange) HasShardingKey ¶ added in v0.5.0
func (shard *NumberRange) HasShardingKey(key string) bool
func (*NumberRange) NextID ¶ added in v0.5.0
func (shard *NumberRange) NextID() (int64, error)
func (*NumberRange) Shard ¶ added in v0.5.0
func (shard *NumberRange) Shard(condition *KeyCondition) (Condition, error)
func (*NumberRange) ShardRange ¶ added in v0.5.0
func (shard *NumberRange) ShardRange(cond1, cond2 *KeyCondition) (Condition, error)
type ShardingAlgorithm ¶
type ShardingAlgorithm interface { HasShardingKey(key string) bool Shard(condition *KeyCondition) (Condition, error) ShardRange(cond1, cond2 *KeyCondition) (Condition, error) AllShards() Condition AllowFullScan() bool proto.SequenceGenerator }
func NewShardingAlgorithm ¶ added in v0.5.0
func NewShardingAlgorithm(algorithm, shardingKey string, allowFullScan bool, topology *topo.Topology, config map[string]interface{}, generator proto.SequenceGenerator) (ShardingAlgorithm, error)
type TableIndexSliceCondition ¶
type TableIndexSliceCondition []int
func (TableIndexSliceCondition) And ¶
func (cond TableIndexSliceCondition) And(cond2 Condition) Condition
func (TableIndexSliceCondition) Or ¶
func (cond TableIndexSliceCondition) Or(cond2 Condition) Condition
func (TableIndexSliceCondition) ParseTopology ¶
func (cond TableIndexSliceCondition) ParseTopology(topology *topo.Topology) (bool, map[string][]string)
ParseTopology return whether you need full scan, and db tables map
type TrueCondition ¶
type TrueCondition struct{}
func (TrueCondition) And ¶
func (cond TrueCondition) And(cond2 Condition) Condition
func (TrueCondition) Or ¶
func (cond TrueCondition) Or(cond2 Condition) Condition
func (TrueCondition) Shard ¶
func (cond TrueCondition) Shard(alg ShardingAlgorithm) (TableIndexSliceCondition, error)
Click to show internal directories.
Click to hide internal directories.