Documentation ¶
Index ¶
- func NewShardingTransactor(connectionProvider ConnectionProvider, shardKeyProvider ShardKeyProvider) gotx.Transactor
- func NewTransactor(connectionProvider ConnectionProvider) gotx.Transactor
- type ClientProvider
- type ConnectionProvider
- type DefaultClientProvider
- type DefaultConnectionProvider
- type ShardKeyProvider
- type ShardingConnectionProvider
- type Transactor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewShardingTransactor ¶
func NewShardingTransactor(connectionProvider ConnectionProvider, shardKeyProvider ShardKeyProvider) gotx.Transactor
func NewTransactor ¶
func NewTransactor(connectionProvider ConnectionProvider) gotx.Transactor
Types ¶
type ClientProvider ¶
type ClientProvider interface {
CurrentClient(ctx context.Context) (reader redis.Cmdable, writer redis.Cmdable)
}
------------------------------------ Client ------------------------------------
func NewDefaultClientProvider ¶
func NewDefaultClientProvider(connectionProvider ConnectionProvider) ClientProvider
func NewShardingDefaultClientProvider ¶
func NewShardingDefaultClientProvider(connectionProvider ConnectionProvider, shardKeyProvider ShardKeyProvider) ClientProvider
type ConnectionProvider ¶
-------------------------------- Connection --------------------------------
func NewDefaultConnectionProvider ¶
func NewDefaultConnectionProvider(client *redis.Client) ConnectionProvider
func NewShardingConnectionProvider ¶
func NewShardingConnectionProvider(db []*redis.Client, maxSlot uint32, shardKeyProvider ShardKeyProvider) ConnectionProvider
type DefaultClientProvider ¶
type DefaultClientProvider struct {
// contains filtered or unexported fields
}
func (*DefaultClientProvider) CurrentClient ¶
type DefaultConnectionProvider ¶
type DefaultConnectionProvider struct {
// contains filtered or unexported fields
}
get redis client from field
func (*DefaultConnectionProvider) CurrentConnection ¶
func (p *DefaultConnectionProvider) CurrentConnection(_ context.Context) *redis.Client
type ShardKeyProvider ¶
type ShardingConnectionProvider ¶
type ShardingConnectionProvider struct {
// contains filtered or unexported fields
}
get db by hash slot
func (*ShardingConnectionProvider) CurrentConnection ¶
func (p *ShardingConnectionProvider) CurrentConnection(ctx context.Context) *redis.Client
type Transactor ¶
type Transactor struct {
// contains filtered or unexported fields
}
------------------------------------ Transactor ------------------------------------
func (*Transactor) Required ¶
func (t *Transactor) Required(ctx context.Context, fn gotx.DoInTransaction, options ...gotx.Option) error
func (*Transactor) RequiresNew ¶
func (t *Transactor) RequiresNew(ctx context.Context, fn gotx.DoInTransaction, options ...gotx.Option) error
Click to show internal directories.
Click to hide internal directories.