store

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	PUBLIC_SCHEMA = "public"
	TABLE_NAME    = "orchestrator"
)

Variables

View Source
var (
	// ErrKeyNotFound returns an error if key is not found in store
	ErrKeyNotFound = errors.New("key not found in store")
)

Functions

This section is empty.

Types

type BadgerDBStore

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

BadgerDBStore store for db

func (*BadgerDBStore) Close

func (s *BadgerDBStore) Close() error

Close db, by closing all the open handles

func (*BadgerDBStore) Count

func (s *BadgerDBStore) Count(prefix string) (uint64, error)

func (*BadgerDBStore) CountJsonPath

func (s *BadgerDBStore) CountJsonPath(prefix, jsonPath string, iter ValueIterator) error

func (*BadgerDBStore) Delete

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

Delete deletes key from db

func (*BadgerDBStore) DeletePrefix

func (s *BadgerDBStore) DeletePrefix(prefix string) error

Delete deletes prefix from db

func (*BadgerDBStore) LoadJSON

func (s *BadgerDBStore) LoadJSON(key string, value interface{}) error

LoadJSON loads key, value and unmarshals json value

func (*BadgerDBStore) LoadKeys

func (s *BadgerDBStore) LoadKeys(prefix string) ([]string, error)

LoadAll loads all keys with a prefix from db

func (*BadgerDBStore) LoadValues

func (s *BadgerDBStore) LoadValues(prefix string, iter ValueIterator) error

func (*BadgerDBStore) QueryJsonPath

func (s *BadgerDBStore) QueryJsonPath(prefix, jsonPath string, iter ValueIterator) error

func (*BadgerDBStore) SaveJSON

func (s *BadgerDBStore) SaveJSON(key string, jsonValue interface{}) error

Save db with key json value pair

func (*BadgerDBStore) SortedAscN

func (s *BadgerDBStore) SortedAscN(prefix, jsonPath string, limit int64, iter ValueIterator) error

func (*BadgerDBStore) SortedDescN

func (s *BadgerDBStore) SortedDescN(prefix, jsonPath string, limit int64, iter ValueIterator) error

type PgxStore

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

PgxStore stores key value pairs in postgres db

func (*PgxStore) Close

func (s *PgxStore) Close() error

Close

func (*PgxStore) Count

func (s *PgxStore) Count(prefix string) (uint64, error)

func (*PgxStore) CountJsonPath

func (s *PgxStore) CountJsonPath(prefix, jsonPath string, iter ValueIterator) error

func (*PgxStore) Delete

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

Delete deletes key from store

func (*PgxStore) DeletePrefix

func (s *PgxStore) DeletePrefix(prefix string) error

Delete deletes prefix pattern from store

func (*PgxStore) LoadJSON

func (s *PgxStore) LoadJSON(key string, value interface{}) error

LoadJSON loads key, value and unmarshals json value

func (*PgxStore) LoadKeys

func (s *PgxStore) LoadKeys(prefix string) ([]string, error)

LoadAll loads all keys

func (*PgxStore) LoadValues

func (s *PgxStore) LoadValues(prefix string, iter ValueIterator) error

func (*PgxStore) QueryJsonPath

func (s *PgxStore) QueryJsonPath(prefix, jsonPath string, iter ValueIterator) error

func (*PgxStore) SaveJSON

func (s *PgxStore) SaveJSON(key string, jsonValue interface{}) error

Save db with key json value pair

func (*PgxStore) SortedAscN

func (s *PgxStore) SortedAscN(prefix, jsonPath string, limit int64, iter ValueIterator) error

func (*PgxStore) SortedDescN

func (s *PgxStore) SortedDescN(prefix, jsonPath string, limit int64, iter ValueIterator) error

type PgxStoreTest

type PgxStoreTest struct {
	PgxStore
}

func (*PgxStoreTest) Close

func (s *PgxStoreTest) Close() error

Close

type Store

type Store interface {
	SaveJSON(key string, value interface{}) error                                      // Save key json value to store, returns error on failure
	Delete(key string) error                                                           // Delete key from store, returns error on failure
	LoadJSON(key string, value interface{}) error                                      // Load key from store, unmarshals json value, returns error on failure
	LoadKeys(prefix string) ([]string, error)                                          // Load all keys from store, returns error on failure
	LoadValues(prefix string, iter ValueIterator) error                                // Loads all keys and values from store, return error on failure
	Count(prefix string) (uint64, error)                                               // returns count of specified prefix, or error on failure
	CountJsonPath(prefix, jsonPath string, iter ValueIterator) error                   // returns grouped count of jsonpath, returns error on failure
	QueryJsonPath(prefix, jsonPath string, iter ValueIterator) error                   // returns key and value of jsonpath, returns error on failure
	SortedAscN(prefix string, jsonPath string, limit int64, iter ValueIterator) error  // returns N key values, sorted ascending order by jsonpath, returns error on failure
	SortedDescN(prefix string, jsonPath string, limit int64, iter ValueIterator) error // returns N key values, sorted descending order by jsonpath, returns error on failure
	DeletePrefix(prefix string) error                                                  // Delete prefix pattern from store, returns error on failure
	Close() error
}

Store provides a way for defining multiple stores

func NewBadgerDBStore

func NewBadgerDBStore(dir, masterKey string) (Store, error)

NewBadgerDBStore creates a new badger store

func NewDefaultPgxStore

func NewDefaultPgxStore(databaseURL string) (Store, error)

func NewPgxStore

func NewPgxStore(databaseURL, schema, table string) (Store, error)

NewPgxStore creates a new postgres store

func NewPgxStoreWithTable

func NewPgxStoreWithTable(databaseURL, table string) (Store, error)

NewPgxStore creates a new postgres store

type ValueIterator

type ValueIterator func(any, any) error

Jump to

Keyboard shortcuts

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