redis

package
v0.0.0-...-8447c62 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataSource

type DataSource struct {
	RedisConn *redis.Client
}

func CreateDataSource

func CreateDataSource() *DataSource

func (DataSource) Expire

func (s DataSource) Expire(key string, seconds time.Duration) (bool, error)

Expire 设置key的超时

func (DataSource) HGetAll

func (s DataSource) HGetAll(key string) (map[string]string, error)

HGetAll 获取key里所有域&值

func (DataSource) HGetInt64

func (s DataSource) HGetInt64(key string, field string) (int64, error)

HGetInt64 获取key里指定域&值 并尝试将值转为int64

func (DataSource) HIncrBy

func (s DataSource) HIncrBy(key string, field string, incValue int64) (int64, error)

HIncrBy 增加

func (DataSource) HMGetInt64

func (s DataSource) HMGetInt64(key string, fields ...string) (map[string]int64, error)

HMGetInt64 获取key里指定一系列域&值 并尝试将值转为int64

func (DataSource) HSet

func (s DataSource) HSet(key string, field string, val interface{}) (int64, error)

HSet 设置key里指定的域&值

func (DataSource) Increase

func (s DataSource) Increase(key, field string, v int64) (newV int64, err error)

Increase 增加

func (DataSource) QueryAll

func (s DataSource) QueryAll(key string) (values map[string]int64, err error)

QueryAll 查询指定key的所有域数据

func (DataSource) QueryByList

func (s DataSource) QueryByList(key string, fields ...string) (values map[string]int64, err error)

QueryByList 根据指定域查询多个数据

func (DataSource) QueryOne

func (s DataSource) QueryOne(key, field string) (v int64, err error)

QueryOne 查询指定一个数据

func (DataSource) UpdateMax

func (s DataSource) UpdateMax(key, field string, v int64) (newV int64, err error)

UpdateMax 更新最大值

func (DataSource) UpdateMinus

func (s DataSource) UpdateMinus(key, field string, v int64) (newV int64, err error)

UpdateMinus 更新最小值

Jump to

Keyboard shortcuts

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