Documentation ¶
Index ¶
- type MemoryStore
- func (ms *MemoryStore) FindByPrefix(prefix string, since int64, unseen bool, values interface{}) error
- func (ms *MemoryStore) Get(key string, value interface{}) (bool, error)
- func (ms *MemoryStore) MarkSeen(key string) (updated bool, err error)
- func (ms *MemoryStore) Remove(key string) error
- func (ms *MemoryStore) Set(key string, value interface{}) error
- type PostgresStore
- func (ps *PostgresStore) Close() error
- func (ps *PostgresStore) FindByPrefix(prefix string, since int64, unseen bool, values interface{}) error
- func (ps *PostgresStore) Get(key string, value interface{}) (bool, error)
- func (ps *PostgresStore) MarkSeen(key string) (updated bool, err error)
- func (ps *PostgresStore) Remove(key string) error
- func (ps *PostgresStore) Set(key string, value interface{}) error
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore - in-memory store
func (*MemoryStore) FindByPrefix ¶
func (ms *MemoryStore) FindByPrefix( prefix string, since int64, unseen bool, values interface{}, ) error
FindByPrefix - load all values whose key starts with the given prefix that were updated after since. If unseen is true, only return values that have not been marked seen.
func (*MemoryStore) Get ¶
func (ms *MemoryStore) Get(key string, value interface{}) (bool, error)
Get - load data for a given key. value passed must be a reference. (false, nil) is returned if key does not exist.
func (*MemoryStore) MarkSeen ¶
func (ms *MemoryStore) MarkSeen(key string) (updated bool, err error)
MarkSeen - mark the value with the given key as seen
func (*MemoryStore) Remove ¶
func (ms *MemoryStore) Remove(key string) error
Remove - remove a key. does not return an error if key does not exist
func (*MemoryStore) Set ¶
func (ms *MemoryStore) Set(key string, value interface{}) error
Set - save data under a given key
type PostgresStore ¶
type PostgresStore struct {
// contains filtered or unexported fields
}
PostgresStore - persistent postgres store
func NewPostgresStore ¶
func NewPostgresStore(url, tableName string) (*PostgresStore, error)
NewPostgresStore - make a connection to a PostgreSQL instance, and return a PostgresStore
func (*PostgresStore) Close ¶
func (ps *PostgresStore) Close() error
Close - close PostgreSQL connection
func (*PostgresStore) FindByPrefix ¶
func (ps *PostgresStore) FindByPrefix( prefix string, since int64, unseen bool, values interface{}, ) error
FindByPrefix - load all values whose key starts with the given prefix that were updated after since. If unseen is true, only return values that have not been marked seen.
func (*PostgresStore) Get ¶
func (ps *PostgresStore) Get(key string, value interface{}) (bool, error)
Get - load data for a given key. value passed must be a reference. (false, nil) is returned if key does not exist.
func (*PostgresStore) MarkSeen ¶
func (ps *PostgresStore) MarkSeen(key string) (updated bool, err error)
MarkSeen - mark the value with the given key as seen
func (*PostgresStore) Remove ¶
func (ps *PostgresStore) Remove(key string) error
Remove - remove a key. does not return an error if key does not exist
func (*PostgresStore) Set ¶
func (ps *PostgresStore) Set(key string, value interface{}) error
Set - save the value to the postgres database under a given key
type Store ¶
type Store interface { Set(key string, value interface{}) error Get(key string, value interface{}) (ok bool, err error) FindByPrefix( prefix string, since int64, unseen bool, values interface{}, ) error MarkSeen(key string) (updated bool, err error) Remove(key string) error }
Store - store interface