Documentation ¶
Index ¶
- func FxLifeCycle[T Client]() fx.Option
- func NewFxRepo[T any]() fx.Option
- func NewRedisFx[T RedisConfig]() fx.Option
- type BinaryDataRepo
- type BinaryValue
- type Client
- type RedisClient
- func (c *RedisClient) Connect(ctx context.Context) error
- func (c *RedisClient) Disconnect(context.Context) error
- func (c *RedisClient) Drop(ctx context.Context, key string) error
- func (c *RedisClient) Get(ctx context.Context, key string) ([]byte, error)
- func (c *RedisClient) Set(ctx context.Context, key string, value []byte) error
- func (c *RedisClient) SetWithExpiry(ctx context.Context, key string, value []byte, duration time.Duration) error
- type RedisConfig
- type RedisConfigTyped
- type Repo
- type TypedRedisClient
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FxLifeCycle ¶
func NewRedisFx ¶
func NewRedisFx[T RedisConfig]() fx.Option
Types ¶
type BinaryDataRepo ¶
type BinaryDataRepo interface { Set(c context.Context, key string, value []byte) error SetWithExpiry(c context.Context, key string, value []byte, duration time.Duration) error Get(c context.Context, key string) ([]byte, error) ErrKeyNotFound(err error) bool Drop(c context.Context, key string) error }
func NewNatsKVBinaryRepo ¶
func NewNatsKVBinaryRepo(ctx context.Context, bucketName string, jc *nats.JetstreamClient) (BinaryDataRepo, error)
type BinaryValue ¶
type Client ¶
type Client interface { Connect(ctx context.Context) error Disconnect(ctx context.Context) error Set(c context.Context, key string, value []byte) error SetWithExpiry(c context.Context, key string, value []byte, duration time.Duration) error Drop(c context.Context, key string) error Get(c context.Context, key string) ([]byte, error) }
func NewRedisClient ¶
type RedisClient ¶
type RedisClient struct {
// contains filtered or unexported fields
}
func (*RedisClient) Disconnect ¶
func (c *RedisClient) Disconnect(context.Context) error
func (*RedisClient) SetWithExpiry ¶
type RedisConfig ¶
type RedisConfig interface {
RedisOptions() (hosts, username, password, basePrefix string)
}
type RedisConfigTyped ¶
type Repo ¶
type Repo[T any] interface { Set(c context.Context, key string, value T) error SetWithExpiry(c context.Context, key string, value T, duration time.Duration) error Get(c context.Context, key string) (T, error) ErrKeyNotFound(err error) bool Drop(c context.Context, key string) error }
func NewNatsKVRepo ¶
type TypedRedisClient ¶
type TypedRedisClient[T Client] struct { // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.