Documentation ¶
Overview ¶
Package goRedis: GoRedis https://juejin.cn/post/7027347979065360392#heading-34
Index ¶
- Constants
- type ArrayResult
- type Client
- func (cli *Client) AppendString(key string, value string) *Result
- func (cli *Client) BGSave()
- func (cli *Client) CheckClient() error
- func (cli *Client) Close() error
- func (cli *Client) Connect() error
- func (cli *Client) ConnectCustom(connect func(client *Client, args []interface{}) error) error
- func (cli *Client) CreateHashKey(maps string, key string, value interface{}) *Result
- func (cli *Client) CreateString(key string, value interface{}) *Result
- func (cli *Client) CreateStringWithExpire(key string, value interface{}, expireTime time.Duration) *Result
- func (cli *Client) DecreaseString(key string) *Result
- func (cli *Client) DecreaseStringByRange(key string, step int64) *Result
- func (cli *Client) DeleteHash(maps string) *Result
- func (cli *Client) DeleteHashKey(maps string, key string) *Result
- func (cli *Client) DeleteString(key string) *Result
- func (cli *Client) DeleteStrings(keys ...string) *Result
- func (cli *Client) ExecuteDo(args ...interface{}) *InterfaceResult
- func (cli Client) GetAllList(list string) *ArrayResult
- func (cli *Client) GetClient() *redis.Client
- func (cli Client) GetListRange(list string, start int64, stop int64) *ArrayResult
- func (cli Client) GetListSize(list string) *Result
- func (cli Client) GetListTrim(list string, start int64, stop int64) *Result
- func (cli *Client) GetSetString(key string, value interface{}) *Result
- func (cli *Client) IncreaseString(key string) *Result
- func (cli *Client) IncreaseStringByRange(key string, step int64) *Result
- func (cli Client) LeftPopList(list string) *Result
- func (cli Client) LeftPushList(list string, key string, value interface{}) *Result
- func (cli *Client) ListHash(maps string) *MapResult
- func (cli *Client) ListHashKey(maps string) *ArrayResult
- func (cli *Client) ListHashValue(maps string) *ArrayResult
- func (cli *Client) ReadHashKey(maps string, key string) *Result
- func (cli *Client) ReadString(key string) *Result
- func (cli *Client) ReadStringWithExpire()
- func (cli *Client) ReadStrings(keys ...string) *InterfaceResult
- func (cli Client) RemoveListKey(list string, key string, times int64) *Result
- func (cli Client) RightPopLeftPushList(list string, key string) *Result
- func (cli Client) RightPopList(list string) *Result
- func (cli Client) RightPushList(list string, key string, value interface{}) *Result
- func (cli *Client) Save()
- func (cli *Client) SearchHashKey(maps string, pattern string) *ArrayResult
- func (cli *Client) SearchStringWithKey(pattern string) *ArrayResult
- func (cli *Client) UpdateHashKey(maps string, key string, value interface{}) *Result
- func (cli Client) UpdateList(list string, key int64, value interface{}) *Result
- func (cli *Client) UpdateString(key string, value interface{}) *Result
- func (cli *Client) UpdateStringExpire(key string, expireTime time.Duration) *Result
- func (cli *Client) UpdateStringWithExpire(key string, value interface{}, expireTime time.Duration) *Result
- type InterfaceResult
- type MapResult
- type Result
Constants ¶
const ErrorClientIsNil = "Redis Client is nil. "
ErrorClientIsNil 当对应当Client指针为空时抛出的错误。
const ErrorDuplicateKey = "Duplicate key. "
ErrorDuplicateKey 当尝试创建某键值对时,如已存在对应键名抛出的错误。
const ErrorNotFound = "redis: nil"
ErrorNotFound 中数据查询为空时的返回值。
const ErrorWIP = "This function is Working in Progress. "
ErrorWIP 调用正在开发的函数将会抛出此错误。
const StatusDeleted = 1
StatusDeleted 正常删除的返回值。
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArrayResult ¶
ArrayResult 字符串数组结果封装。
type Client ¶
type Client struct { Address string `json:"address"` Password string `json:"password"` Database int `json:"database"` ReadOnly bool `json:"read_only"` Args []interface{} `json:"args"` Client *redis.Client `json:"client"` TLS *tls.Config `json:"tls"` }
Client 封装客户端所需参数的结构体。
func (*Client) AppendString ¶
AppendString 字符串值追加。
func (*Client) ConnectCustom ¶
ConnectCustom 客户端连接函数,完全自定义连接方式。
func (*Client) CreateHashKey ¶
func (*Client) CreateString ¶
CreateString 创建永久字符串键值对。
func (*Client) CreateStringWithExpire ¶
func (cli *Client) CreateStringWithExpire(key string, value interface{}, expireTime time.Duration) *Result
CreateStringWithExpire 创建带过期时间的字符串键值对。
func (*Client) DecreaseString ¶
DecreaseString 自减字符串键值。
func (*Client) DecreaseStringByRange ¶
DecreaseStringByRange 根据提供步长自减字符串键值。
func (*Client) DeleteHash ¶
func (*Client) DeleteString ¶
DeleteString 删除对应字符串键值。
func (*Client) DeleteStrings ¶
DeleteStrings 删除对应的一组字符串键值。
func (*Client) ExecuteDo ¶
func (cli *Client) ExecuteDo(args ...interface{}) *InterfaceResult
ExecuteDo 直接处理Redis命令。
func (Client) GetAllList ¶
func (cli Client) GetAllList(list string) *ArrayResult
func (Client) GetListRange ¶
func (cli Client) GetListRange(list string, start int64, stop int64) *ArrayResult
func (Client) GetListSize ¶
func (Client) GetListTrim ¶
func (*Client) GetSetString ¶
GetSetString 字符串键值对读取原有值并更新为输入值。
func (*Client) IncreaseString ¶
IncreaseString 自增字符串键值。
func (*Client) IncreaseStringByRange ¶
IncreaseStringByRange 根据提供步长自增字符串键值。
func (Client) LeftPopList ¶
func (Client) LeftPushList ¶
func (*Client) ListHashKey ¶
func (cli *Client) ListHashKey(maps string) *ArrayResult
func (*Client) ListHashValue ¶
func (cli *Client) ListHashValue(maps string) *ArrayResult
func (*Client) ReadStringWithExpire ¶
func (cli *Client) ReadStringWithExpire()
ReadStringWithExpire 获取对应字符串键值。
func (*Client) ReadStrings ¶
func (cli *Client) ReadStrings(keys ...string) *InterfaceResult
ReadStrings 获取数个键名对应对键值。
func (Client) RemoveListKey ¶
func (Client) RightPopLeftPushList ¶
func (Client) RightPopList ¶
func (Client) RightPushList ¶
func (*Client) SearchHashKey ¶
func (cli *Client) SearchHashKey(maps string, pattern string) *ArrayResult
func (*Client) SearchStringWithKey ¶
func (cli *Client) SearchStringWithKey(pattern string) *ArrayResult
SearchStringWithKey 字符串按键名搜索。
func (*Client) UpdateHashKey ¶
func (Client) UpdateList ¶
func (*Client) UpdateString ¶
UpdateString 更新字符串键值对。
func (*Client) UpdateStringExpire ¶
UpdateStringExpire 更新字符串超时时间。
type InterfaceResult ¶
InterfaceResult 任意类型结果返回封装。
func InterfaceResultPointer ¶
func InterfaceResultPointer() *InterfaceResult
InterfaceResultPointer 任意类型空结果指针。