store

package
v2.4.7+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

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 NewMemoryStore

func NewMemoryStore() *MemoryStore

NewMemoryStore - construct a MemoryStore

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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