Documentation ¶
Index ¶
- func CloseMysqlDB()
- func CloseRedis()
- func GetMysqlDB() *gorm.DB
- func InitInfluxDB()
- func InitMysqlDB()
- func InitRedisDB()
- type InfluxDB
- func (i *InfluxDB) BuildQuery(bucket, measurement, field, aggPeriod, aggFn, actionStr, uuid string, ...) string
- func (i *InfluxDB) BuildQueryWithCount(bucket, period, measurement, uuid string) string
- func (i *InfluxDB) BuildQueryWithPage(bucket, period, measurement, uuid string, pagesize, page int) string
- func (i *InfluxDB) GetQueryAPI() api.QueryAPI
- func (i *InfluxDB) GetWriteAPI() api.WriteAPIBlocking
- type RealRedisClient
- func (r *RealRedisClient) Close() error
- func (r *RealRedisClient) Del(ctx context.Context, keys ...string) *redis.IntCmd
- func (r *RealRedisClient) Exists(ctx context.Context, keys ...string) *redis.IntCmd
- func (r *RealRedisClient) Expire(ctx context.Context, key string, ttl time.Duration) *redis.BoolCmd
- func (r *RealRedisClient) ExpireAt(ctx context.Context, key string, ttl time.Time) *redis.BoolCmd
- func (r *RealRedisClient) Get(ctx context.Context, key string) *redis.StringCmd
- func (r *RealRedisClient) HDel(ctx context.Context, key string, fields ...string) *redis.IntCmd
- func (r *RealRedisClient) HExists(ctx context.Context, key, field string) *redis.BoolCmd
- func (r *RealRedisClient) HGet(ctx context.Context, key, field string) *redis.StringCmd
- func (r *RealRedisClient) HGetAll(ctx context.Context, key string) *redis.StringStringMapCmd
- func (r *RealRedisClient) HIncrBy(ctx context.Context, key, field string, incr int64) *redis.IntCmd
- func (r *RealRedisClient) HKeys(ctx context.Context, key string) *redis.StringSliceCmd
- func (r *RealRedisClient) HLen(ctx context.Context, key string) *redis.IntCmd
- func (r *RealRedisClient) HMGet(ctx context.Context, key string, fields ...string) *redis.SliceCmd
- func (r *RealRedisClient) HMSet(ctx context.Context, key string, values ...interface{}) *redis.BoolCmd
- func (r *RealRedisClient) HSet(ctx context.Context, key string, values ...interface{}) *redis.IntCmd
- func (r *RealRedisClient) Incr(ctx context.Context, key string) *redis.IntCmd
- func (r *RealRedisClient) LIndex(ctx context.Context, key string, index int64) *redis.StringCmd
- func (r *RealRedisClient) LLen(ctx context.Context, key string) *redis.IntCmd
- func (r *RealRedisClient) LPop(ctx context.Context, key string) *redis.StringCmd
- func (r *RealRedisClient) LPush(ctx context.Context, key string, values ...interface{}) *redis.IntCmd
- func (r *RealRedisClient) LRange(ctx context.Context, key string, start, stop int64) *redis.StringSliceCmd
- func (r *RealRedisClient) LRem(ctx context.Context, key string, count int64, value interface{}) *redis.IntCmd
- func (r *RealRedisClient) LTrim(ctx context.Context, key string, start, stop int64) *redis.StatusCmd
- func (r *RealRedisClient) Pipeline() redis.Pipeliner
- func (r *RealRedisClient) Pipelined(ctx context.Context, fn func(redis.Pipeliner) error) ([]redis.Cmder, error)
- func (r *RealRedisClient) RPop(ctx context.Context, key string) *redis.StringCmd
- func (r *RealRedisClient) RPush(ctx context.Context, key string, values ...interface{}) *redis.IntCmd
- func (r *RealRedisClient) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd
- func (r *RealRedisClient) TTL(ctx context.Context, key string) *redis.DurationCmd
- func (r *RealRedisClient) TxPipeline() redis.Pipeliner
- func (r *RealRedisClient) TxPipelined(ctx context.Context, fn func(redis.Pipeliner) error) ([]redis.Cmder, error)
- func (r *RealRedisClient) Watch(ctx context.Context, fn func(*redis.Tx) error, keys ...string) error
- func (r *RealRedisClient) ZAdd(ctx context.Context, key string, members ...*redis.Z) *redis.IntCmd
- func (r *RealRedisClient) ZRange(ctx context.Context, key string, start, stop int64) *redis.StringSliceCmd
- func (r *RealRedisClient) ZRem(ctx context.Context, key string, members ...interface{}) *redis.IntCmd
- type RedisClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type InfluxDB ¶
type InfluxDB struct { // for query Org string Bucket string // contains filtered or unexported fields }
InfluxDB influxdb client.
func (*InfluxDB) BuildQuery ¶
func (i *InfluxDB) BuildQuery(bucket, measurement, field, aggPeriod, aggFn, actionStr, uuid string, startTime, endTime int64, ) string
BuildQuery build query string.
func (*InfluxDB) BuildQueryWithCount ¶
BuildQueryWithCount build query string with count.
func (*InfluxDB) BuildQueryWithPage ¶
func (i *InfluxDB) BuildQueryWithPage(bucket, period, measurement, uuid string, pagesize, page int, ) string
BuildQueryWithPage build query string with page.
func (*InfluxDB) GetQueryAPI ¶
GetQueryAPI get query api.
func (*InfluxDB) GetWriteAPI ¶
func (i *InfluxDB) GetWriteAPI() api.WriteAPIBlocking
GetWriteAPI get write api.
type RealRedisClient ¶
type RealRedisClient struct {
// contains filtered or unexported fields
}
RealRedisClient implemented the RedisClient interface and used a real Redis client.
func (*RealRedisClient) Del ¶
func (r *RealRedisClient) Del(ctx context.Context, keys ...string) *redis.IntCmd
Del delete key.
func (*RealRedisClient) Exists ¶
func (r *RealRedisClient) Exists(ctx context.Context, keys ...string) *redis.IntCmd
Exists check some keys are exis.
func (*RealRedisClient) Get ¶
func (r *RealRedisClient) Get(ctx context.Context, key string) *redis.StringCmd
Get get value.
func (*RealRedisClient) HDel ¶
func (r *RealRedisClient) HDel(ctx context.Context, key string, fields ...string) *redis.IntCmd
HDel hdel.
func (*RealRedisClient) HExists ¶
func (r *RealRedisClient) HExists(ctx context.Context, key, field string) *redis.BoolCmd
HExists hexists.
func (*RealRedisClient) HGet ¶
func (r *RealRedisClient) HGet(ctx context.Context, key, field string) *redis.StringCmd
HGet hget.
func (*RealRedisClient) HGetAll ¶
func (r *RealRedisClient) HGetAll(ctx context.Context, key string) *redis.StringStringMapCmd
HGetAll hgetall.
func (*RealRedisClient) HIncrBy ¶
func (r *RealRedisClient) HIncrBy(ctx context.Context, key, field string, incr int64) *redis.IntCmd
HIncrBy hincrby.
func (*RealRedisClient) HKeys ¶
func (r *RealRedisClient) HKeys(ctx context.Context, key string) *redis.StringSliceCmd
HKeys hkeys.
func (*RealRedisClient) HLen ¶
func (r *RealRedisClient) HLen(ctx context.Context, key string) *redis.IntCmd
HLen hlen.
func (*RealRedisClient) HMGet ¶
func (r *RealRedisClient) HMGet(ctx context.Context, key string, fields ...string) *redis.SliceCmd
HMGet hmget.
func (*RealRedisClient) HMSet ¶
func (r *RealRedisClient) HMSet(ctx context.Context, key string, values ...interface{}) *redis.BoolCmd
HMSet hmset.
func (*RealRedisClient) HSet ¶
func (r *RealRedisClient) HSet(ctx context.Context, key string, values ...interface{}) *redis.IntCmd
HSet hset.
func (*RealRedisClient) Incr ¶
func (r *RealRedisClient) Incr(ctx context.Context, key string) *redis.IntCmd
Incr incr key.
func (*RealRedisClient) LIndex ¶
func (r *RealRedisClient) LIndex(ctx context.Context, key string, index int64) *redis.StringCmd
LIndex get index value.
func (*RealRedisClient) LLen ¶
func (r *RealRedisClient) LLen(ctx context.Context, key string) *redis.IntCmd
LLen get list length.
func (*RealRedisClient) LPop ¶
func (r *RealRedisClient) LPop(ctx context.Context, key string) *redis.StringCmd
LPop left pop value from list.
func (*RealRedisClient) LPush ¶
func (r *RealRedisClient) LPush(ctx context.Context, key string, values ...interface{}) *redis.IntCmd
LPush left push value to list.
func (*RealRedisClient) LRange ¶
func (r *RealRedisClient) LRange(ctx context.Context, key string, start, stop int64) *redis.StringSliceCmd
LRange get list value from start to stop.
func (*RealRedisClient) LRem ¶
func (r *RealRedisClient) LRem(ctx context.Context, key string, count int64, value interface{}) *redis.IntCmd
LRem remove count value from list.
func (*RealRedisClient) LTrim ¶
func (r *RealRedisClient) LTrim(ctx context.Context, key string, start, stop int64) *redis.StatusCmd
LTrim trim list from start to stop.
func (*RealRedisClient) Pipeline ¶
func (r *RealRedisClient) Pipeline() redis.Pipeliner
Pipeline pipline.
func (*RealRedisClient) Pipelined ¶
func (r *RealRedisClient) Pipelined(ctx context.Context, fn func(redis.Pipeliner) error) ([]redis.Cmder, error)
Pipelined pipelined.
func (*RealRedisClient) RPop ¶
func (r *RealRedisClient) RPop(ctx context.Context, key string) *redis.StringCmd
RPop right pop value from list.
func (*RealRedisClient) RPush ¶
func (r *RealRedisClient) RPush(ctx context.Context, key string, values ...interface{}) *redis.IntCmd
RPush right push value to list.
func (*RealRedisClient) Set ¶
func (r *RealRedisClient) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd
Set set key value pair to redis.
func (*RealRedisClient) TTL ¶
func (r *RealRedisClient) TTL(ctx context.Context, key string) *redis.DurationCmd
TTL get ttl of key.
func (*RealRedisClient) TxPipeline ¶
func (r *RealRedisClient) TxPipeline() redis.Pipeliner
TxPipeline tx pipeline.
func (*RealRedisClient) TxPipelined ¶
func (r *RealRedisClient) TxPipelined(ctx context.Context, fn func(redis.Pipeliner) error) ([]redis.Cmder, error)
TxPipelined tx pipelined.
func (*RealRedisClient) Watch ¶
func (r *RealRedisClient) Watch(ctx context.Context, fn func(*redis.Tx) error, keys ...string) error
Watch watch.
func (*RealRedisClient) ZAdd ¶
func (r *RealRedisClient) ZAdd(ctx context.Context, key string, members ...*redis.Z) *redis.IntCmd
ZAdd zset add.
type RedisClient ¶
type RedisClient interface { // default Get(ctx context.Context, key string) *redis.StringCmd Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd TTL(ctx context.Context, key string) *redis.DurationCmd Expire(ctx context.Context, key string, ttl time.Duration) *redis.BoolCmd ExpireAt(ctx context.Context, key string, ttl time.Time) *redis.BoolCmd Exists(ctx context.Context, keys ...string) *redis.IntCmd Del(ctx context.Context, keys ...string) *redis.IntCmd Incr(ctx context.Context, key string) *redis.IntCmd Close() error // List LPush(ctx context.Context, key string, values ...interface{}) *redis.IntCmd RPush(ctx context.Context, key string, values ...interface{}) *redis.IntCmd LPop(ctx context.Context, key string) *redis.StringCmd RPop(ctx context.Context, key string) *redis.StringCmd LRange(ctx context.Context, key string, start, stop int64) *redis.StringSliceCmd LRem(ctx context.Context, key string, count int64, value interface{}) *redis.IntCmd LTrim(ctx context.Context, key string, start, stop int64) *redis.StatusCmd LLen(ctx context.Context, key string) *redis.IntCmd LIndex(ctx context.Context, key string, index int64) *redis.StringCmd // tx Pipelined(ctx context.Context, fn func(redis.Pipeliner) error) ([]redis.Cmder, error) Pipeline() redis.Pipeliner TxPipelined(ctx context.Context, fn func(redis.Pipeliner) error) ([]redis.Cmder, error) TxPipeline() redis.Pipeliner // ZSet ZAdd(ctx context.Context, key string, members ...*redis.Z) *redis.IntCmd ZRem(ctx context.Context, key string, members ...interface{}) *redis.IntCmd ZRange(ctx context.Context, key string, start, stop int64) *redis.StringSliceCmd // map HSet(ctx context.Context, key string, values ...interface{}) *redis.IntCmd HGet(ctx context.Context, key, field string) *redis.StringCmd HGetAll(ctx context.Context, key string) *redis.StringStringMapCmd HDel(ctx context.Context, key string, fields ...string) *redis.IntCmd HExists(ctx context.Context, key, field string) *redis.BoolCmd HIncrBy(ctx context.Context, key, field string, incr int64) *redis.IntCmd HKeys(ctx context.Context, key string) *redis.StringSliceCmd HLen(ctx context.Context, key string) *redis.IntCmd HMGet(ctx context.Context, key string, fields ...string) *redis.SliceCmd HMSet(ctx context.Context, key string, values ...interface{}) *redis.BoolCmd Watch(ctx context.Context, fn func(*redis.Tx) error, keys ...string) error }
RedisClient the interface defines the methods for interacting with Redis clients.