Versions in this module Expand all Collapse all v8 v8.0.0 Sep 8, 2020 Changes in this version + var DefaultIDGen = NewIDGen(41, 11, 12, _epoch) + type Cluster struct + func NewCluster(dbs []*pg.DB, nshards int) *Cluster + func NewClusterWithGen(dbs []*pg.DB, nshards int, gen *IDGen) *Cluster + func (cl *Cluster) Close() error + func (cl *Cluster) DB(number int64) (int, *pg.DB) + func (cl *Cluster) DBs() []*pg.DB + func (cl *Cluster) ForEachDB(fn func(db *pg.DB) error) error + func (cl *Cluster) ForEachNShards(n int, fn func(shard *pg.DB) error) error + func (cl *Cluster) ForEachShard(fn func(shard *pg.DB) error) error + func (cl *Cluster) IDGen() *IDGen + func (cl *Cluster) Shard(number int64) *pg.DB + func (cl *Cluster) Shards(db *pg.DB) []*pg.DB + func (cl *Cluster) SplitShard(id int64) *pg.DB + func (cl *Cluster) SubCluster(number int64, size int) *SubCluster + type IDGen struct + func NewIDGen(timeBits, shardBits, seqBits uint, epoch time.Time) *IDGen + func (g *IDGen) MakeID(tm time.Time, shard, seq int64) int64 + func (g *IDGen) MaxID(tm time.Time) int64 + func (g *IDGen) MinID(tm time.Time) int64 + func (g *IDGen) NumShards() int + func (g *IDGen) SplitID(id int64) (tm time.Time, shardID int64, seqID int64) + type ShardIDGen struct + func NewShardIDGen(shard int64, gen *IDGen) *ShardIDGen + func (g *ShardIDGen) MaxID(tm time.Time) int64 + func (g *ShardIDGen) MinID(tm time.Time) int64 + func (g *ShardIDGen) NextID(tm time.Time) int64 + func (g *ShardIDGen) SplitID(id int64) (tm time.Time, shardID int64, seqID int64) + type SubCluster struct + func (cl *SubCluster) ForEachNShards(n int, fn func(shard *pg.DB) error) error + func (cl *SubCluster) ForEachShard(fn func(shard *pg.DB) error) error + func (cl *SubCluster) Shard(number int64) *pg.DB + func (cl *SubCluster) SplitShard(id int64) *pg.DB + type UUID [uuidLen]byte + func NewUUID(shardID int64, tm time.Time) UUID + func ParseUUID(b []byte) (UUID, error) + func (u *UUID) IsZero() bool + func (u *UUID) Scan(b interface{}) error + func (u *UUID) ShardID() int64 + func (u *UUID) Split() (shardID int64, tm time.Time) + func (u *UUID) Time() time.Time + func (u *UUID) UnmarshalBinary(b []byte) error + func (u *UUID) UnmarshalJSON(b []byte) error + func (u *UUID) UnmarshalText(b []byte) error + func (u UUID) AppendValue(b []byte, quote int) ([]byte, error) + func (u UUID) MarshalBinary() ([]byte, error) + func (u UUID) MarshalJSON() ([]byte, error) + func (u UUID) MarshalText() ([]byte, error) + func (u UUID) String() string + func (u UUID) Value() (driver.Value, error) Other modules containing this package github.com/go-pg/sharding github.com/go-pg/sharding/v7