-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterface.go
38 lines (32 loc) · 1.35 KB
/
interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package jq
import (
"context"
"time"
"github.com/go-redis/redis/v8"
)
// RedisClient is because go-redis has many kind of clients.
type RedisClient interface {
Get(ctx context.Context, key string) *redis.StringCmd
Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd
Del(ctx context.Context, keys ...string) *redis.IntCmd
Incr(ctx context.Context, key string) *redis.IntCmd
HIncrBy(ctx context.Context, key, field string, incr int64) *redis.IntCmd
HGetAll(ctx context.Context, key string) *redis.StringStringMapCmd
Exists(ctx context.Context, keys ...string) *redis.IntCmd
Expire(ctx context.Context, key string, expiration time.Duration) *redis.BoolCmd
LPush(ctx context.Context, key string, values ...interface{}) *redis.IntCmd
RPop(ctx context.Context, key string) *redis.StringCmd
LLen(ctx context.Context, key string) *redis.IntCmd
TxPipeline() redis.Pipeliner
}
// Logger can be logrus or zap sugared logger, or your own.
type Logger interface {
Debugf(format string, args ...interface{})
Infof(format string, args ...interface{})
Errorf(format string, args ...interface{})
}
// defaultLogger do nothing
type defaultLogger struct{}
func (defaultLogger) Debugf(_ string, _ ...interface{}) {}
func (defaultLogger) Infof(_ string, _ ...interface{}) {}
func (defaultLogger) Errorf(_ string, _ ...interface{}) {}