Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when a key is passed that is not in the in-memory database
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface { // Save saves the given model under the given key. Example usage: // // err := mydb.Save(models.NewAppKey("app123"), models.App{Name:"myapp"}) // // check error and continue Save(models.Key, models.Model) error // Delete deletes the model under the given key. After delete exits successfully, both the key and the model under it should be removed entirely. Example usage: // // err := mydb.Delete(models.NewAppKey("app123")) // // check error and continue Delete(models.Key) error // Get gets the model under the given key and writes it into the given model. Callers should pass a pointer to a model implementation so that this func can unmarshal the model from the database and write it into the given model. Example usage: // // app := &models.App{} // if err := mydb.Get(models.NewAppKey("app123"), app); err != nil { // fmt.Println("error getting model!") // return // } // // use app Get(models.Key, models.Model) error }
DB is the generic key/value interface for databases that work with this server
type Mem ¶
type Mem struct {
// contains filtered or unexported fields
}
Mem is an in-memory only implementation of DB
func (*Mem) Delete ¶
Delete is the interface implementation. Never returns an error, even if the key didn't exist
type Redis ¶
type Redis struct {
// contains filtered or unexported fields
}
RedisRedis is a db.DB implementation that talks to Redis
func NewRedis ¶
func NewRedis(cl *redis.Client) *Redis
NewRedis initializes and returns a redis DB using the given raw redis.v3 client
Click to show internal directories.
Click to hide internal directories.