storage

package
v2.3.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangedFielder

type ChangedFielder interface {
	ChangedFields() []string
}

ChangedFielder interface is used to see what fields to update

type ListOptions

type ListOptions struct {
	Limit  int
	Offset int
	// contains filtered or unexported fields
}

ListOptions are options for all list commands

func (ListOptions) GetTotalAndSelected

func (o ListOptions) GetTotalAndSelected() (total, selected int)

GetTotalAndSelected returns the total number of items, along with the number of selected items

type RedisKVStore

type RedisKVStore struct {
	// contains filtered or unexported fields
}

RedisKVStore stores arbitrary data in Redis

func NewRedisKVStore

func NewRedisKVStore(client *redis.Client, prefix string) *RedisKVStore

NewRedisKVStore creates a new RedisKVStore

func (*RedisKVStore) Create

func (s *RedisKVStore) Create(key string, value string) error

Create a new record, prepending the prefix to the key if necessary

func (*RedisKVStore) Delete

func (s *RedisKVStore) Delete(key string) error

Delete an existing record, prepending the prefix to the key if necessary

func (*RedisKVStore) Get

func (s *RedisKVStore) Get(key string) (string, error)

Get one result, prepending the prefix to the key if necessary

func (*RedisKVStore) GetAll

func (s *RedisKVStore) GetAll(keys []string, options *ListOptions) (map[string]string, error)

GetAll returns all results for the given keys, prepending the prefix to the keys if necessary

func (*RedisKVStore) List

func (s *RedisKVStore) List(selector string, options *ListOptions) (map[string]string, error)

List all results matching the selector, prepending the prefix to the selector if necessary

func (*RedisKVStore) Update

func (s *RedisKVStore) Update(key string, value string) error

Update an existing record, prepending the prefix to the key if necessary

type RedisMapStore

type RedisMapStore struct {
	// contains filtered or unexported fields
}

RedisMapStore stores structs as HMaps in Redis

func NewRedisMapStore

func NewRedisMapStore(client *redis.Client, prefix string) *RedisMapStore

NewRedisMapStore returns a new RedisMapStore that talks to the given Redis client and respects the given prefix

func (*RedisMapStore) Create

func (s *RedisMapStore) Create(key string, value interface{}, properties ...string) error

Create a new record, prepending the prefix to the key if necessary, optionally setting only the given properties

func (*RedisMapStore) Delete

func (s *RedisMapStore) Delete(key string) error

Delete an existing record, prepending the prefix to the key if necessary

func (*RedisMapStore) Get

func (s *RedisMapStore) Get(key string) (interface{}, error)

Get one result, prepending the prefix to the key if necessary

func (*RedisMapStore) GetAll

func (s *RedisMapStore) GetAll(keys []string, options *ListOptions) ([]interface{}, error)

GetAll returns all results for the given keys, prepending the prefix to the keys if necessary

func (*RedisMapStore) GetFields

func (s *RedisMapStore) GetFields(key string, fields ...string) (interface{}, error)

GetFields for a record, prepending the prefix to the key if necessary

func (*RedisMapStore) List

func (s *RedisMapStore) List(selector string, options *ListOptions) ([]interface{}, error)

List all results matching the selector, prepending the prefix to the selector if necessary

func (*RedisMapStore) SetBase

func (s *RedisMapStore) SetBase(base interface{}, tagName string)

SetBase sets the base struct for automatically encoding and decoding to and from Redis format

func (*RedisMapStore) SetDecoder

func (s *RedisMapStore) SetDecoder(decoder func(input map[string]string) (output interface{}, err error))

SetDecoder sets the decoder to convert structs from Redis format

func (*RedisMapStore) SetEncoder

func (s *RedisMapStore) SetEncoder(encoder func(input interface{}, properties ...string) (map[string]string, error))

SetEncoder sets the encoder to convert structs to Redis format

func (*RedisMapStore) Update

func (s *RedisMapStore) Update(key string, value interface{}, properties ...string) error

Update an existing record, prepending the prefix to the key if necessary, optionally setting only the given properties

type RedisSetStore

type RedisSetStore struct {
	// contains filtered or unexported fields
}

RedisSetStore stores sets in Redis

func NewRedisSetStore

func NewRedisSetStore(client *redis.Client, prefix string) *RedisSetStore

NewRedisSetStore creates a new RedisSetStore

func (*RedisSetStore) Add

func (s *RedisSetStore) Add(key string, values ...string) error

Add one or more values to the set, prepending the prefix to the key if necessary

func (*RedisSetStore) Contains

func (s *RedisSetStore) Contains(key string, value string) (res bool, err error)

Contains returns wheter the set contains a given value, prepending the prefix to the key if necessary

func (*RedisSetStore) Delete

func (s *RedisSetStore) Delete(key string) error

Delete the entire set

func (*RedisSetStore) Get

func (s *RedisSetStore) Get(key string) (res []string, err error)

Get one result, prepending the prefix to the key if necessary

func (*RedisSetStore) GetAll

func (s *RedisSetStore) GetAll(keys []string, options *ListOptions) (map[string][]string, error)

GetAll returns all results for the given keys, prepending the prefix to the keys if necessary

func (*RedisSetStore) List

func (s *RedisSetStore) List(selector string, options *ListOptions) (map[string][]string, error)

List all results matching the selector, prepending the prefix to the selector if necessary

func (*RedisSetStore) Remove

func (s *RedisSetStore) Remove(key string, values ...string) error

Remove one or more values from the set, prepending the prefix to the key if necessary

type Time

type Time struct {
	time.Time
}

Time is a wrapper around time.Time that marshals and unmarshals to the time.RFC3339Nano format

func (Time) MarshalText

func (t Time) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface

func (*Time) UnmarshalText

func (t *Time) UnmarshalText(in []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL