red

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructSchemaKeyForCollection

func ConstructSchemaKeyForCollection(s *Store, col essence.Collection) string

func DeconstructSchemaKey

func DeconstructSchemaKey(schemaKey string) (namespace string, kind string, collectionName string)

parse out and return the important values in a schema-key

func LongToShort

func LongToShort(long string) string

Types

type CollectionMap

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

type KeyValueCollection

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

a KeyValueCollection is a collection that can operate on key-value pairs

func (*KeyValueCollection) All

func (kv *KeyValueCollection) All(ctx context.Context) map[string][]byte

func (*KeyValueCollection) Destroy

func (kv *KeyValueCollection) Destroy(ctx context.Context) error

func (*KeyValueCollection) Get

func (kv *KeyValueCollection) Get(ctx context.Context, shortKey string) ([]byte, error)

func (*KeyValueCollection) Keys

func (kv *KeyValueCollection) Keys(ctx context.Context) []string

func (*KeyValueCollection) Keyspace

func (c *KeyValueCollection) Keyspace() string

a fully-qualified namespace for the collection

func (*KeyValueCollection) Kind

func (c *KeyValueCollection) Kind() string

Kind is always "kv" for this kind of [Collection]

func (*KeyValueCollection) Name

func (c *KeyValueCollection) Name() string

Name is a namespace, or a table name

func (*KeyValueCollection) SchemaKey

func (c *KeyValueCollection) SchemaKey() string

func (*KeyValueCollection) Set

func (kv *KeyValueCollection) Set(ctx context.Context, shortKey string, v []byte) error

func (*KeyValueCollection) Store

func (c *KeyValueCollection) Store() essence.Store

Store is a reference to the backing store (redis server)

type ListCollection

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

func (*ListCollection) All

func (lc *ListCollection) All(ctx context.Context) [][]byte

func (*ListCollection) Destroy

func (lc *ListCollection) Destroy(ctx context.Context) error

func (*ListCollection) Head

func (lc *ListCollection) Head(ctx context.Context) ([]byte, error)

func (*ListCollection) Keyspace

func (c *ListCollection) Keyspace() string

a fully-qualified namespace for the collection

func (*ListCollection) Kind

func (c *ListCollection) Kind() string

Kind is always "kv" for this kind of [Collection]

func (*ListCollection) Name

func (c *ListCollection) Name() string

Name is a namespace, or a table name

func (*ListCollection) Pop

func (lc *ListCollection) Pop(ctx context.Context) ([]byte, error)

func (*ListCollection) Push

func (lc *ListCollection) Push(ctx context.Context, val []byte) error

func (*ListCollection) SchemaKey

func (c *ListCollection) SchemaKey() string

func (*ListCollection) Shift

func (lc *ListCollection) Shift(ctx context.Context) ([]byte, error)

func (*ListCollection) Size

func (lc *ListCollection) Size(ctx context.Context) int

func (*ListCollection) Store

func (c *ListCollection) Store() essence.Store

Store is a reference to the backing store (redis server)

func (*ListCollection) Tail

func (lc *ListCollection) Tail(ctx context.Context) ([]byte, error)

func (*ListCollection) Unshift

func (lc *ListCollection) Unshift(ctx context.Context, val []byte) error

type Store

type Store struct {
	Namespace string
	// contains filtered or unexported fields
}

a Store is a store of persistant data, structured into Collections. Store implements essence.Store.

func Attach

func Attach(ns string, opts *redis.Options) *Store

func (*Store) CollectionExists

func (s *Store) CollectionExists(ctx context.Context, kind, name string) bool

func (*Store) Destroy

func (s *Store) Destroy(ctx context.Context) error

Destroy the entire Store (database namespace) and everything in it

func (*Store) KeyValueCollection

func (s *Store) KeyValueCollection(ctx context.Context, name string) (essence.KeyValueCollection, error)

func (*Store) KeyValueCollections

func (s *Store) KeyValueCollections(ctx context.Context) map[string]essence.KeyValueCollection

func (*Store) ListCollection

func (s *Store) ListCollection(ctx context.Context, name string) (essence.ListCollection, error)

func (*Store) ListCollections

func (s *Store) ListCollections(ctx context.Context) map[string]essence.ListCollection

func (*Store) RemoveCollection

func (s *Store) RemoveCollection(ctx context.Context, col essence.Collection)

remove the collection from the Store's Collection map

Jump to

Keyboard shortcuts

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