Versions in this module Expand all Collapse all v1 v1.0.0 May 24, 2019 Changes in this version + const DateDayRuleType + const DateMonthRuleType + const DateYearRuleType + const DefaultRuleType + const GlobalTableRuleType + const HashRuleType + const LinkedTableRuleType + const MaxMonthDaysCount + const MaxNumKey + const MinMonthDaysCount + const MinNumKey + const ModRuleType + const MonthsCount + const MycatLongRuleType + const MycatModRuleType + const MycatMurmurRuleType + const MycatPaddingModRuleType + const MycatStringRuleType + const PaddingModDefaultMod + const PaddingModDefaultModBegin + const PaddingModDefaultModEnd + const PaddingModDefaultPadFrom + const PaddingModDefaultPadLength + const PaddingModLeftEnd + const PaddingModRightEnd + const PartitionLength + const RangeRuleType + func EncodeValue(value interface{}) string + func GetString(value interface{}) string + func HashValue(value interface{}) uint64 + func IsMycatShardingRule(ruleType string) bool + func NumValue(value interface{}) int64 + func ParseDayRange(dateRange string) ([]int, error) + func ParseMonthRange(dateRange string) ([]int, error) + func ParseYearRange(dateRange string) ([]int, error) + type BaseRule struct + func NewDefaultRule(slice string) *BaseRule + func (r *BaseRule) FindTableIndex(key interface{}) (int, error) + func (r *BaseRule) GetDB() string + func (r *BaseRule) GetDatabaseNameByTableIndex(index int) (string, error) + func (r *BaseRule) GetDatabases() []string + func (r *BaseRule) GetShard() Shard + func (r *BaseRule) GetShardingColumn() string + func (r *BaseRule) GetSlice(i int) string + func (r *BaseRule) GetSliceIndexFromTableIndex(i int) int + func (r *BaseRule) GetSlices() []string + func (r *BaseRule) GetSubTableIndexes() []int + func (r *BaseRule) GetTable() string + func (r *BaseRule) GetTableIndexByDatabaseName(phyDB string) (int, bool) + func (r *BaseRule) GetType() string + func (r *BaseRule) IsLinkedRule() bool + 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 GlobalTableShard struct + func NewGlobalTableShard() *GlobalTableShard + func (s *GlobalTableShard) 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 LinkedRule struct + func (l *LinkedRule) FindTableIndex(key interface{}) (int, error) + func (l *LinkedRule) GetDB() string + func (l *LinkedRule) GetDatabaseNameByTableIndex(index int) (string, error) + func (l *LinkedRule) GetDatabases() []string + func (l *LinkedRule) GetParentDB() string + func (l *LinkedRule) GetParentTable() string + func (l *LinkedRule) GetShard() Shard + func (l *LinkedRule) GetShardingColumn() string + func (l *LinkedRule) GetSlice(i int) string + func (l *LinkedRule) GetSliceIndexFromTableIndex(i int) int + func (l *LinkedRule) GetSlices() []string + func (l *LinkedRule) GetSubTableIndexes() []int + func (l *LinkedRule) GetTable() string + func (l *LinkedRule) GetTableIndexByDatabaseName(phyDB string) (int, bool) + func (l *LinkedRule) GetType() string + func (l *LinkedRule) IsLinkedRule() bool + type ModShard struct + ShardNum int + func (m *ModShard) FindForKey(key interface{}) (int, error) + type MycatPartitionLongShard struct + func NewMycatPartitionLongShard(shardNum int, partitionCount, partitionLength string) *MycatPartitionLongShard + func (m *MycatPartitionLongShard) FindForKey(key interface{}) (int, error) + func (m *MycatPartitionLongShard) Init() error + type MycatPartitionModShard struct + ShardNum int + func NewMycatPartitionModShard(shardNum int) *MycatPartitionModShard + func (m *MycatPartitionModShard) FindForKey(key interface{}) (int, error) + type MycatPartitionMurmurHashShard struct + func NewMycatPartitionMurmurHashShard(seedStr, virtualBucketTimesStr string, count int) (*MycatPartitionMurmurHashShard, error) + func (m *MycatPartitionMurmurHashShard) FindForKey(key interface{}) (int, error) + func (m *MycatPartitionMurmurHashShard) Init() error + func (m *MycatPartitionMurmurHashShard) SetWeightMapFromFile(weightMapPath string) error + type MycatPartitionPaddingModShard struct + func GetMycatPartitionPaddingModShard(padFromStr, padLengthStr, modBeginStr, modEndStr string, mod int) (shard *MycatPartitionPaddingModShard, err error) + func (m *MycatPartitionPaddingModShard) FindForKey(key interface{}) (int, error) + func (m *MycatPartitionPaddingModShard) Init() error + type MycatPartitionStringShard struct + func NewMycatPartitionStringShard(shardNum int, partitionCount, partitionLength string, hashSliceStr string) *MycatPartitionStringShard + func (m *MycatPartitionStringShard) FindForKey(key interface{}) (int, error) + func (m *MycatPartitionStringShard) Init() error + type MycatRule interface + GetDatabases func() []string + GetTableIndexByDatabaseName func(phyDB string) (int, bool) + 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 RangeShard interface + EqualStart func(key interface{}, index int) bool + EqualStop func(key interface{}, index int) bool + type Router struct + func NewRouter(namespace *models.Namespace) (*Router, error) + func (r *Router) GetRule(db, table string) Rule + func (r *Router) GetShardRule(db, table string) (Rule, bool) + type Rule interface + FindTableIndex func(key interface{}) (int, error) + GetDB func() string + GetDatabaseNameByTableIndex func(index int) (string, error) + GetShard func() Shard + GetShardingColumn func() string + GetSlice func(i int) string + GetSliceIndexFromTableIndex func(i int) int + GetSlices func() []string + GetSubTableIndexes func() []int + GetTable func() string + GetType func() string + IsLinkedRule func() bool + type Shard interface + FindForKey func(key interface{}) (int, error) + type Uint64Key uint64 + func (i Uint64Key) String() string