Versions in this module Expand all Collapse all v1 v1.0.1 Jul 6, 2023 v1.0.0 Dec 2, 2022 Changes in this version + const EID_NODE + const LIST_NODE + const MaxNumKey + const MinNumKey + const OTHER_NODE + const VALUE_NODE + var DateDayRuleType = "date_day" + var DateMonthRuleType = "date_month" + var DateYearRuleType = "date_year" + var DefaultRuleType = "default" + var HashRuleType = "hash" + var MaxMonthDaysCount = 31 + var MinMonthDaysCount = 28 + var MonthsCount = 12 + var RangeRuleType = "range" + func EncodeValue(value interface{}) string + func HashValue(value interface{}) uint64 + func NumValue(value interface{}) int64 + func ParseDayRange(dateRange string) ([]int, error) + func ParseMonthRange(dateRange string) ([]int, error) + func ParseYearRange(dateRange string) ([]int, error) + type DateDayShard struct + func (s *DateDayShard) FindForKey(key interface{}) (int, error) + type DateMonthShard struct + func (s *DateMonthShard) FindForKey(key interface{}) (int, error) + type DateYearShard struct + func (s *DateYearShard) FindForKey(key interface{}) (int, error) + type DefaultShard struct + func (s *DefaultShard) FindForKey(key interface{}) (int, error) + type HashShard struct + ShardNum int + func (s *HashShard) FindForKey(key interface{}) (int, error) + type KeyError string + func NewKeyError(format string, args ...interface{}) KeyError + func (ke KeyError) Error() string + type NumKeyRange struct + End int64 + Start int64 + func ParseNumSharding(Locations []int, TableRowLimit int) ([]NumKeyRange, error) + func (kr NumKeyRange) Contains(i int64) bool + func (kr NumKeyRange) MapKey() string + func (kr NumKeyRange) String() string + type NumRangeShard struct + Shards []NumKeyRange + func (s *NumRangeShard) EqualStart(key interface{}, index int) bool + func (s *NumRangeShard) EqualStop(key interface{}, index int) bool + func (s *NumRangeShard) FindForKey(key interface{}) (int, error) + type Plan struct + Criteria sqlparser.SQLNode + InRightToReplace *sqlparser.ComparisonExpr + KeyIndex int + RewrittenSqls map[string][]string + RouteNodeIndexs []int + RouteTableIndexs []int + Rows map[int]sqlparser.Values + Rule *Rule + SubTableValueGroups map[int]sqlparser.ValTuple + func (plan *Plan) GetIRKeyIndex(cols sqlparser.Columns) error + func (plan *Plan) TindexsToNindexs(tableIndexs []int) []int + type RangeShard interface + EqualStart func(key interface{}, index int) bool + EqualStop func(key interface{}, index int) bool + type Router struct + DefaultRule *Rule + Nodes []string + Rules map[string]map[string]*Rule + func NewRouter(schemaConfig *config.SchemaConfig) (*Router, error) + func (r *Router) BuildPlan(db string, statement sqlparser.Statement) (*Plan, error) + func (r *Router) GetRule(db, table string) *Rule + type Rule struct + DB string + Key string + Nodes []string + Shard Shard + SubTableIndexs []int + Table string + TableToNode map[int]int + Type string + func NewDefaultRule(node string) *Rule + func (r *Rule) FindNode(key interface{}) (string, error) + func (r *Rule) FindNodeIndex(key interface{}) (int, error) + func (r *Rule) FindTableIndex(key interface{}) (int, error) + type Shard interface + FindForKey func(key interface{}) (int, error) + type Uint64Key uint64 + func (i Uint64Key) String() string