Documentation ¶
Index ¶
- Variables
- func Mask(cols ...string) []string
- type BooleanKV
- type Counter
- type Counters
- type Database
- func (db *Database) BooleanKV(key string) *BooleanKV
- func (db *Database) Close() error
- func (db *Database) Counters(key string) *Counters
- func (db *Database) DirectClient() *redis.Client
- func (db *Database) FlushAllKeysFromDatabase() error
- func (db *Database) Hash(name string, model Model) *Hash
- func (db *Database) Int32KV(key string) *Int32KV
- func (db *Database) Int64KV(key string) *Int64KV
- func (db *Database) Int64Set(key string) *Int64Set
- func (db *Database) ProtoHash(key string) *ProtoHash
- func (db *Database) ProtoKV(key string) *ProtoKV
- func (db *Database) ProtoList(key string) *ProtoList
- func (db *Database) PubSub(name string) *PubSub
- func (db *Database) StringKV(key string) *StringKV
- func (db *Database) StringsList(key string) *StringsList
- func (db *Database) StringsSet(key string) *StringsSet
- func (db *Database) TimeKV(key string) *TimeKV
- type Hash
- type Int32KV
- type Int64KV
- type Int64Set
- type MaskOpt
- type Model
- type MultiError
- type ProtoHash
- type ProtoHashInsert
- type ProtoKV
- type ProtoList
- type PubSub
- type PubSubSubscription
- type StringKV
- type StringsList
- type StringsSet
- type TimeKV
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoSuchEntity is returned from a Get operation when there is not a model // that matches the query ErrNoSuchEntity = errors.New("no such entity") ErrDone = errors.New("done") )
Functions ¶
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
func (*Counter) IncrementBy ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database keeps a connection to a Redis server.
func (*Database) DirectClient ¶
DirectClient returns the underlying client of go-redis to call advanced methods not exposed through this library. Please consider to add the functionality here after it's tested to improve all the users of the library.
func (*Database) FlushAllKeysFromDatabase ¶
FlushAllKeysFromDatabase is exposed as a simple way for tests to reset the local database. It is not intended to be run in production. It will clean up all the keys of the whole database and leav an empty canvas to fill again.
func (*Database) Hash ¶ added in v1.1.0
Hash returns a hash instance that stores full models as individual hash keys.
func (*Database) PubSub ¶
PubSub returns an entrypoint to a PubSub queue in redisIt can be used to publish and receive protobuf messages.
func (*Database) StringsList ¶
func (db *Database) StringsList(key string) *StringsList
func (*Database) StringsSet ¶
func (db *Database) StringsSet(key string) *StringsSet
type Hash ¶ added in v1.1.0
type Hash struct {
// contains filtered or unexported fields
}
type Model ¶ added in v1.1.0
type Model interface { // IsRedisModel should always return true. IsRedisModel() bool }
Model should be implemented by any model that want to be serializable to redis keys.
type MultiError ¶
type MultiError []error
MultiError is returned from batch operations with the error of each operation. If a batch operation does not fails this will be nil too.
func (MultiError) Error ¶
func (merr MultiError) Error() string
Error returns the composed error message with all the individual ones.
func (MultiError) HasError ¶
func (merr MultiError) HasError() bool
HasError checks if there is really an error on the list or all of them are empty.
type ProtoHash ¶
type ProtoHash struct {
// contains filtered or unexported fields
}
func (*ProtoHash) GetMulti ¶
GetMulti fetchs a list of keys from the hash. Result should be a slice of proto.Message that will be filled with the results in the same order as the keys.
func (*ProtoHash) PrepareInsert ¶
func (hash *ProtoHash) PrepareInsert() *ProtoHashInsert
type ProtoHashInsert ¶
type ProtoHashInsert struct {
// contains filtered or unexported fields
}
func (*ProtoHashInsert) Commit ¶
func (insert *ProtoHashInsert) Commit() error
type ProtoKV ¶
type ProtoKV struct {
// contains filtered or unexported fields
}
ProtoKV interacts with a protobuf value key.
type ProtoList ¶
type ProtoList struct {
// contains filtered or unexported fields
}
type PubSub ¶
type PubSub struct {
// contains filtered or unexported fields
}
PubSub represents a connection to a redis PubSub. It can be used to publish and receive protobuf messages.
func (*PubSub) Publish ¶
Publish sends a new message to the server. Only subscription connected at the same time will receive the message.
func (*PubSub) Subscribe ¶
func (pubsub *PubSub) Subscribe() *PubSubSubscription
Subscribe opens a new connection to the server and starts downloading messages.
type PubSubSubscription ¶
type PubSubSubscription struct {
// contains filtered or unexported fields
}
PubSubSubscription stores the state of an active connection to the server.
func (*PubSubSubscription) Close ¶
func (sub *PubSubSubscription) Close()
Close exits the connection.
type StringsList ¶
type StringsList struct {
// contains filtered or unexported fields
}
func (*StringsList) Add ¶
func (list *StringsList) Add(values []string) error
func (*StringsList) GetAll ¶
func (list *StringsList) GetAll() ([]string, error)
func (*StringsList) GetRange ¶
func (list *StringsList) GetRange(start, end int64) ([]string, error)
func (*StringsList) Len ¶
func (list *StringsList) Len() (int64, error)
func (*StringsList) Remove ¶
func (list *StringsList) Remove(value string) error
type StringsSet ¶
type StringsSet struct {
// contains filtered or unexported fields
}
func (*StringsSet) Add ¶
func (set *StringsSet) Add(values ...string) error
func (*StringsSet) Len ¶
func (set *StringsSet) Len() (int64, error)
func (*StringsSet) Members ¶
func (set *StringsSet) Members() ([]string, error)
func (*StringsSet) Remove ¶
func (set *StringsSet) Remove(values ...string) error
func (*StringsSet) SortAlpha ¶
func (set *StringsSet) SortAlpha() ([]string, error)