redis

package module
v0.0.0-...-8748ea0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientProvider

type ClientProvider interface {
	CurrentClient(ctx context.Context) (reader redis.Cmdable, writer redis.Cmdable)
}

type ConnectionProvider

type ConnectionProvider interface {
	CurrentConnection(ctx context.Context) *redis.Client
}

type DefaultClientProvider

type DefaultClientProvider struct {
	// contains filtered or unexported fields
}

func NewDefaultClientProvider

func NewDefaultClientProvider(connectionProvider ConnectionProvider) *DefaultClientProvider

func NewShardingDefaultClientProvider

func NewShardingDefaultClientProvider(connectionProvider ConnectionProvider, shardKeyProvider ShardKeyProvider) *DefaultClientProvider

func (*DefaultClientProvider) CurrentClient

func (p *DefaultClientProvider) CurrentClient(ctx context.Context) (reader redis.Cmdable, writer redis.Cmdable)

type DefaultConnectionProvider

type DefaultConnectionProvider struct {
	// contains filtered or unexported fields
}

get redis client from field

func NewDefaultConnectionProvider

func NewDefaultConnectionProvider(client *redis.Client) *DefaultConnectionProvider

func (*DefaultConnectionProvider) CurrentConnection

func (p *DefaultConnectionProvider) CurrentConnection(_ context.Context) *redis.Client

type ShardKeyProvider

type ShardKeyProvider func(ctx context.Context) string

type ShardingConnectionProvider

type ShardingConnectionProvider struct {
	// contains filtered or unexported fields
}

get db by hash slot

func NewShardingConnectionProvider

func NewShardingConnectionProvider(db []*redis.Client, maxSlot uint32, shardKeyProvider ShardKeyProvider) *ShardingConnectionProvider

func (*ShardingConnectionProvider) CurrentConnection

func (p *ShardingConnectionProvider) CurrentConnection(ctx context.Context) *redis.Client

type Transactor

type Transactor struct {
	// contains filtered or unexported fields
}

func NewShardingTransactor

func NewShardingTransactor(connectionProvider ConnectionProvider, shardKeyProvider ShardKeyProvider) *Transactor

func NewTransactor

func NewTransactor(connectionProvider ConnectionProvider) *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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL