Documentation
¶
Index ¶
- Variables
- type Client
- type ClientAPI
- type MockClient
- func (r *MockClient) Close() error
- func (r *MockClient) Get(key string) *redis.StringCmd
- func (r *MockClient) HDel(key string, fields ...string) *redis.IntCmd
- func (r *MockClient) HGet(key string, field string) *redis.StringCmd
- func (r *MockClient) HGetAll(key string) *redis.StringStringMapCmd
- func (r *MockClient) HSet(key string, values ...interface{}) *redis.IntCmd
- func (r *MockClient) Incr(key string) *redis.IntCmd
- func (r *MockClient) Keys(pattern string) *redis.StringSliceCmd
- func (r *MockClient) Ping() *redis.StatusCmd
- func (r *MockClient) Scan(cursor uint64, match string, count int64) *redis.ScanCmd
- func (r *MockClient) Set(key string, value interface{}, expiration time.Duration) *redis.StatusCmd
- type Redis
- type RedisAPI
- type RedisDB
- func (r *RedisDB) Connect() error
- func (r *RedisDB) Get(ctx context.Context, key string) (string, error)
- func (r *RedisDB) HDel(ctx context.Context, key string, fields ...string) error
- func (r *RedisDB) HGet(ctx context.Context, key string, field string, response interface{}) error
- func (r *RedisDB) HGetAll(ctx context.Context, key string) (map[string]string, error)
- func (r *RedisDB) HSet(ctx context.Context, key string, field string, data interface{}) error
- func (r *RedisDB) Incr(ctx context.Context, key string) (int64, error)
- func (r *RedisDB) Keys(ctx context.Context, pattern string) ([]string, error)
- func (r *RedisDB) Scan(ctx context.Context, match string, count int) (map[string]string, error)
- func (r *RedisDB) Set(ctx context.Context, key string, expiry time.Duration, data interface{}) error
Constants ¶
This section is empty.
Variables ¶
View Source
var NilRedis string = "redis: nil"
NilRedis ...
Functions ¶
This section is empty.
Types ¶
type ClientAPI ¶
type ClientAPI interface { Ping() *redis.StatusCmd Close() error HDel(string, ...string) *redis.IntCmd Get(string) *redis.StringCmd HGet(string, string) *redis.StringCmd HGetAll(string) *redis.StringStringMapCmd Keys(string) *redis.StringSliceCmd Scan(uint64, string, int64) *redis.ScanCmd Incr(string) *redis.IntCmd Set(string, interface{}, time.Duration) *redis.StatusCmd HSet(string, ...interface{}) *redis.IntCmd }
ClientAPI is the internal Client API interface
type MockClient ¶
type MockClient struct { ClientAPI PingErr error HDelErr error GetValue string GetErr error HGetValue string HGetErr error HGetAllValue map[string]string HGetAllErr error KeysValue []string KeysErr error ScanValue []string ScanCursor uint64 ScanErr error IncrValue int64 IncrErr error SetValue string SetErr error HSetValue int64 HSetErr error }
MockClient is the internal mock client
func (*MockClient) Get ¶
func (r *MockClient) Get(key string) *redis.StringCmd
Get is an internal mock method
func (*MockClient) HDel ¶
func (r *MockClient) HDel(key string, fields ...string) *redis.IntCmd
HDel is an internal mock method
func (*MockClient) HGet ¶
func (r *MockClient) HGet(key string, field string) *redis.StringCmd
HGet is an internal mock method
func (*MockClient) HGetAll ¶
func (r *MockClient) HGetAll(key string) *redis.StringStringMapCmd
HGetAll is an internal mock method
func (*MockClient) HSet ¶
func (r *MockClient) HSet(key string, values ...interface{}) *redis.IntCmd
HSet is an internal mock method
func (*MockClient) Incr ¶
func (r *MockClient) Incr(key string) *redis.IntCmd
Incr is an internal mock method
func (*MockClient) Keys ¶
func (r *MockClient) Keys(pattern string) *redis.StringSliceCmd
Keys is an internal mock method
func (*MockClient) Ping ¶
func (r *MockClient) Ping() *redis.StatusCmd
Ping is an internal mock method
type Redis ¶
type Redis struct { AddressSvc string `mapstructure:"address"` Port string `mapstructure:"port"` Password string `mapstructure:"password"` DB int `mapstructure:"db"` }
Redis connexion struct
type RedisAPI ¶
type RedisAPI interface { Connect() error // Set set a key/value with an expiry duration, after this duration the key/value is deleted from redis Set(ctx context.Context, key string, expiry time.Duration, data interface{}) error // HSet ... HSet(ctx context.Context, key string, field string, data interface{}) error // HDel ... HDel(ctx context.Context, key string, fields ...string) error // Get ... Get(ctx context.Context, key string) (string, error) // HGet ... HGet(ctx context.Context, key string, field string, response interface{}) error // HGetAll ... HGetAll(ctx context.Context, key string) (map[string]string, error) // Keys return all keys from redis if the pattern is set to "*", not safe, use Scan instead Keys(ctx context.Context, pattern string) ([]string, error) // Scan returns every keys from a redis database safely Scan(ctx context.Context, match string, count int) (map[string]string, error) // Incr ... Incr(ctx context.Context, key string) (int64, error) }
RedisAPI is the public Redis API interface
type RedisDB ¶
type RedisDB struct { ClientAPI // contains filtered or unexported fields }
RedisDB is the public Redis Instance
func (*RedisDB) Keys ¶
Keys return all keys from redis if the pattern is set to "*", not safe, use Scan instead
Click to show internal directories.
Click to hide internal directories.