Documentation ¶
Index ¶
- func GetKeyPrefix(key string) (bkey []byte, rangEnd []byte)
- func GetPermission(key string, permName string) *pb.Permission
- type Client
- func (c *Client) AuthDisable() error
- func (c *Client) AuthEnable() error
- func (c *Client) Authenticate(username, password string) (string, error)
- func (c *Client) Clear() error
- func (c *Client) Close()
- func (c *Client) CloseEventChannel(id int64)
- func (c *Client) DecrementFloat(key string, by float64) (float64, error)
- func (c *Client) DecrementInt(key string, by int64) (int64, error)
- func (c *Client) DelHashField(key, field string) error
- func (c *Client) Delete(key string) error
- func (c *Client) Get(key string) util.Value
- func (c *Client) GetHashField(key, field string) util.Value
- func (c *Client) GetHashFields(key string, fields []string) (map[string]util.Value, error)
- func (c *Client) GetListItem(key string, index int64) util.Value
- func (c *Client) GetMany(keys []string) (map[string]util.Value, error)
- func (c *Client) GetWithPrefix(prefix string) (map[string]util.Value, error)
- func (c *Client) Has(key string) (bool, error)
- func (c *Client) HashFields(key string) ([]string, error)
- func (c *Client) HashHas(key, field string) (bool, error)
- func (c *Client) HashLength(key string) (int64, error)
- func (c *Client) HashValues(key string) ([]util.Value, error)
- func (c *Client) IncrementFloat(key string, by float64) (float64, error)
- func (c *Client) IncrementInt(key string, by int64) (int64, error)
- func (c *Client) Keys() ([]string, error)
- func (c *Client) KeysWithPrefix(prefix string) ([]string, error)
- func (c *Client) Length(key string) (int64, error)
- func (c *Client) ListAppend(key string, v interface{}) error
- func (c *Client) ListDelete(key string, index int64) error
- func (c *Client) ListDeleteItem(key string, v interface{}) (int64, error)
- func (c *Client) ListHas(key string, v interface{}) (int64, error)
- func (c *Client) ListInsert(key string, index int64, v interface{}) error
- func (c *Client) ListLength(key string) (int64, error)
- func (c *Client) ListLimit(key string, limit int64) error
- func (c *Client) ListPopLeft(key string) util.Value
- func (c *Client) ListPopLeftBlock(key string, timeout int64) util.Value
- func (c *Client) ListPopRight(key string) util.Value
- func (c *Client) ListPopRightBlock(key string, timeout int64) util.Value
- func (c *Client) Lock(key string) error
- func (c *Client) LockWithTimeout(key string, seconds int64) error
- func (c *Client) LogOut()
- func (c *Client) NewEventChannel() (ch chan *pb.Event, id int64)
- func (c *Client) RoleAdd(role string) error
- func (c *Client) RoleDelete(role string) error
- func (c *Client) RoleGet(role string) ([]*pb.Permission, error)
- func (c *Client) RoleGrantPermission(role string, perm *pb.Permission) error
- func (c *Client) RoleList() ([]string, error)
- func (c *Client) RoleRevokePermission(role string, perm *pb.Permission) error
- func (c *Client) Set(key string, v interface{}) error
- func (c *Client) SetExpire(key string, seconds int64) error
- func (c *Client) SetHashField(key, field string, v interface{}) error
- func (c *Client) SetHashFields(key string, vals map[string]util.Value) error
- func (c *Client) SetListItem(key string, index int64, v interface{}) error
- func (c *Client) SetLockTimeout(seconds int64)
- func (c *Client) SetMany(vals map[string]util.Value) (map[string]string, error)
- func (c *Client) SetNX(key string, v interface{}) (bool, error)
- func (c *Client) Unlock(key string) error
- func (c *Client) UnlockThenSet(key string, v util.Value) error
- func (c *Client) Unwatch(key string, prefix bool)
- func (c *Client) UserAdd(username, password string) error
- func (c *Client) UserChangePassword(username, password string) error
- func (c *Client) UserDelete(username string) error
- func (c *Client) UserGet(username string) ([]string, error)
- func (c *Client) UserGrantRole(username, role string) error
- func (c *Client) UserList() ([]string, error)
- func (c *Client) UserRevokeRole(username, role string) error
- func (c *Client) Watch(key string, prefix bool)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetKeyPrefix ¶
GetKeyPrefix returns the actual rangeStart and rangeEnd for keys that end with '*'.
func GetPermission ¶
func GetPermission(key string, permName string) *pb.Permission
GetPermission returns a new Permission object for the given information or nil if permName unrecognized.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client object.
func (*Client) AuthDisable ¶
AuthDisable disables authentication.
func (*Client) Authenticate ¶
Authenticate processes an authenticate request.
func (*Client) CloseEventChannel ¶
CloseEventChannel closes the Event channel.
func (*Client) DecrementFloat ¶
DecrementFloat decrements a float stored at the given key by the given number and returns new value.
func (*Client) DecrementInt ¶
DecrementInt decrements an integer stored at the given key by the given number and returns new value.
func (*Client) DelHashField ¶
DelHashField deletes a field from a hash.
func (*Client) GetHashField ¶
GetHashField gets a single value in a hash.
func (*Client) GetHashFields ¶
GetHashFields gets multiple hash values.
func (*Client) GetListItem ¶
GetListItem gets a single item from a list by index, supports negative indexing.
func (*Client) GetWithPrefix ¶
GetWithPrefix gets the keys with the given prefix.
func (*Client) HashFields ¶
HashFields gets a list of the fields in a hash.
func (*Client) HashLength ¶
HashLength returns the number of fields in a hash.
func (*Client) HashValues ¶
HashValues gets a list of the values in a hash.
func (*Client) IncrementFloat ¶
IncrementFloat increments a float stored at the given key by the given number and returns new value.
func (*Client) IncrementInt ¶
IncrementInt increments an integer stored at the given key by the given number and returns new value.
func (*Client) KeysWithPrefix ¶
KeysWithPrefix returns a list of keys with the given prefix.
func (*Client) ListAppend ¶
ListAppend inserts a new item at the end of the list.
func (*Client) ListDelete ¶
ListDelete removes an item from a list by index.
func (*Client) ListDeleteItem ¶
ListDeleteItem removes the first occurrence of value from a list, returns index or -1 if not found.
func (*Client) ListHas ¶
ListHas determines if a list contains an item, returns index or -1 if not found.
func (*Client) ListInsert ¶
ListInsert inserts a new item at the given index in the list.
func (*Client) ListLength ¶
ListLength gets the number of items in a list.
func (*Client) ListLimit ¶
ListLimit sets the maximum length of a list, removing items from the top once limit is reached.
func (*Client) ListPopLeft ¶
ListPopLeft returns and removes the first item in a list.
func (*Client) ListPopLeftBlock ¶
ListPopLeftBlock returns and removes the first item in a list, or waits the given number of seconds for a value, timeout of zero waits forever.
func (*Client) ListPopRight ¶
ListPopRight returns and removes the last item in a list.
func (*Client) ListPopRightBlock ¶
ListPopRightBlock returns and removes the last item in a list, or waits the given number of seconds for a value, timeout of zero waits forever.
func (*Client) LockWithTimeout ¶
LockWithTimeout locks a key, waiting for the given number of seconds if already locked before returning an error.
func (*Client) LogOut ¶
func (c *Client) LogOut()
LogOut removes the cached authentication token, reverting the client to pre-Authenticate state.
func (*Client) NewEventChannel ¶
NewEventChannel returns a new Event channel.
func (*Client) RoleDelete ¶
RoleDelete deletes a specified role.
func (*Client) RoleGet ¶
func (c *Client) RoleGet(role string) ([]*pb.Permission, error)
RoleGet gets detailed role information.
func (*Client) RoleGrantPermission ¶
func (c *Client) RoleGrantPermission(role string, perm *pb.Permission) error
RoleGrantPermission grants a permission of a specified key or range to a specified role.
func (*Client) RoleRevokePermission ¶
func (c *Client) RoleRevokePermission(role string, perm *pb.Permission) error
RoleRevokePermission revokes a key or range permission of a specified key.
func (*Client) SetHashField ¶
SetHashField sets a single value in a hash.
func (*Client) SetHashFields ¶
SetHashFields sets multiple values in a hash.
func (*Client) SetListItem ¶
SetListItem sets a single item in a list by index.
func (*Client) SetLockTimeout ¶
SetLockTimeout sets the default timeout in seconds if already locked.
func (*Client) UnlockThenSet ¶
UnlockThenSet unlocks a key, then immediately sets its value.
func (*Client) UserChangePassword ¶
UserChangePassword changes the password of the specified user.
func (*Client) UserDelete ¶
UserDelete deletes a specified user.
func (*Client) UserGrantRole ¶
UserGrantRole grants a role to a specified user.
func (*Client) UserRevokeRole ¶
UserRevokeRole revokes a role from a specified user.
type Config ¶
type Config struct { Addresses []string TLS *tls.Config AutoTLS bool // contains filtered or unexported fields }
Config object.
func NewClientConfig ¶
NewClientConfig returns a new ClientConfig with default values.
func NewClientConfigAddresses ¶
NewClientConfigAddresses returns a new ClientConfig multiple node addresses.