Documentation ¶
Index ¶
- Variables
- func KPV(key string, values []string) []interface{}
- type DB
- func (c *DB) Del(key string) (bool, error)
- func (c *DB) Do(command string, args ...interface{}) (reply interface{}, err error)
- func (c *DB) Expire(key string, second uint64) (bool, error)
- func (c *DB) Exsits(key string) (bool, error)
- func (c *DB) Get(key string) (string, error)
- func (c *DB) HDel(name string, keys ...string) (uint64, error)
- func (c *DB) HExists(name, key string) (bool, error)
- func (c *DB) HGet(name, key string) (string, error)
- func (c *DB) HGetAll(name string) (map[string]string, error)
- func (c *DB) HKeys(name string) ([]string, error)
- func (c *DB) HLen(name string) (uint64, error)
- func (c *DB) HMSet(name string, hash map[string]string) (bool, error)
- func (c *DB) HSet(name, key, value string) (uint64, error)
- func (c *DB) HVals(name string) ([]string, error)
- func (c *DB) Keys(pattern string) ([]string, error)
- func (c *DB) LLen(key string) (uint64, error)
- func (c *DB) LPop(key string) (string, error)
- func (c *DB) LRange(key string, start, end int) ([]string, error)
- func (c *DB) Ping() (bool, error)
- func (c *DB) Pipeline() *TranCommand
- func (c *DB) RPop(key string) (string, error)
- func (c *DB) RPush(key string, values ...string) (uint64, error)
- func (c *DB) SAdd(key string, members ...string) (uint64, error)
- func (c *DB) SCard(key string) (uint64, error)
- func (c *DB) SIsMember(key, member string) (bool, error)
- func (c *DB) SMembers(key string) ([]string, error)
- func (c *DB) SRem(key string, members ...string) (uint64, error)
- func (c *DB) Set(key, value string) (bool, error)
- func (c *DB) TTL(key string) (uint64, error)
- func (c *DB) Type(key string) (string, error)
- type TranCommand
- func (t *TranCommand) Del(key string) error
- func (t *TranCommand) Execute() ([]interface{}, error)
- func (t *TranCommand) HDel(name string, keys ...string) error
- func (t *TranCommand) HSet(name, key, value string) error
- func (t *TranCommand) RPush(key string, values ...string) error
- func (t *TranCommand) SAdd(key string, members ...string) error
- func (t *TranCommand) SRem(key string, members ...string) error
- func (t *TranCommand) Send(command string, args ...interface{}) error
- func (t *TranCommand) Set(key, value string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrTranClosed = errors.New("pipeline closed")
管道已经关闭(已经使用 Execute 提交)
Functions ¶
Types ¶
type DB ¶
type DB struct { // key前缀 Prefix string // contains filtered or unexported fields }
DB 一个数据库连接结构
func (*DB) Pipeline ¶
func (c *DB) Pipeline() *TranCommand
Pipeline 开启事务,使用 Execute 方法提交事务。 使用示例:
t := instance.Pipeline()
t.Set/RPush/Del...(or use Send method)
t.Execute()
type TranCommand ¶
type TranCommand struct {
// contains filtered or unexported fields
}
TranCommand 表示事务管道。 执行流程是:由 `DB.Pipeline` 开启,通过 Send 缓冲命令,最后 Execute 发送。
func (*TranCommand) HDel ¶ added in v0.4.4
func (t *TranCommand) HDel(name string, keys ...string) error
HDel 管道中的 HDel
func (*TranCommand) RPush ¶
func (t *TranCommand) RPush(key string, values ...string) error
RPush 管道中的 RPush
func (*TranCommand) SAdd ¶
func (t *TranCommand) SAdd(key string, members ...string) error
SAdd 管道中的 SAdd
func (*TranCommand) SRem ¶
func (t *TranCommand) SRem(key string, members ...string) error
SRem 管道中的 SRem
func (*TranCommand) Send ¶
func (t *TranCommand) Send(command string, args ...interface{}) error
Send 将命令写入客户端的输出缓冲区。
Click to show internal directories.
Click to hide internal directories.