Versions in this module Expand all Collapse all v0 v0.0.2 Dec 22, 2023 Changes in this version type Shards + func (this *Shards) GetShardUserCount() (result map[string]int, err error) + func (this *Shards) SelectShard() (shardUrl string, err error) v0.0.1 Dec 19, 2023 Changes in this version + const CachePrefix + const MaxInt + const MaxUint + const MinUint + const SQLListShards + const SqlCreateShardTable + const SqlCreateShardsMappingTable + const SqlCreateUserShard + const SqlDeleteShard + const SqlDeleteShardUsers + const SqlDeleteUserShard + const SqlEnsureShard + const SqlSelectShardByUser + const SqlShardUserCount + var ErrorNotFound = errors.New("no shard assigned to user") + type Shards struct + func New(pgConnStr string, cache cache.Cache) (*Shards, error) + func (this *Shards) EnsureShard(shardUrl string) (err error) + func (this *Shards) EnsureShardForUser(userId string) (shardUrl string, err error) + func (this *Shards) GetShardForUser(userId string) (shardUrl string, err error) + func (this *Shards) GetShards() (result []string, err error) + func (this *Shards) RemoveShard(shard string) (err error) + func (this *Shards) SetShardForUser(userId string, shardAddress string) (err error) + type Tx interface + Exec func(query string, args ...interface{}) (sql.Result, error) + Query func(query string, args ...interface{}) (*sql.Rows, error) + QueryContext func(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) + QueryRow func(query string, args ...interface{}) *sql.Row + QueryRowContext func(ctx context.Context, query string, args ...interface{}) *sql.Row