kvstore

package
v0.0.0-...-90365bb Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

func GetJSON

func GetJSON(ctx context.Context, s Store, k string, v interface{}) error

func PutJSON

func PutJSON(ctx context.Context, s Store, k string, v interface{}) error

Types

type Config

type Config = storefactory.Config

type FSStore

type FSStore struct {
	RootPath string
	Options  map[string]string
}

func (*FSStore) Delete

func (f *FSStore) Delete(_ context.Context, k string) error

func (*FSStore) Get

func (f *FSStore) Get(_ context.Context, k string) ([]byte, error)

func (*FSStore) Put

func (f *FSStore) Put(_ context.Context, k string, v []byte) error

func (*FSStore) Setup

func (f *FSStore) Setup(context.Context) error

func (*FSStore) Teardown

func (f *FSStore) Teardown(context.Context) error

type Factory

type Factory struct {
	Name string
}

func (Factory) MustOpen

func (f Factory) MustOpen(ctx context.Context, l L.L, cfg *Config) Store

func (Factory) MustOpenString

func (f Factory) MustOpenString(ctx context.Context, l L.L, text string) Store

func (Factory) Open

func (f Factory) Open(ctx context.Context, l L.L, cfg *Config) (Store, error)

func (Factory) OpenString

func (f Factory) OpenString(ctx context.Context, l L.L, text string) (Store, error)

type GORMStore

type GORMStore struct {
	DB        *gorm.DB
	TableName string
}

func (*GORMStore) Delete

func (g *GORMStore) Delete(ctx context.Context, key string) error

func (*GORMStore) Get

func (g *GORMStore) Get(ctx context.Context, key string) ([]byte, error)

func (*GORMStore) Put

func (g *GORMStore) Put(ctx context.Context, k string, v []byte) error

func (*GORMStore) Setup

func (g *GORMStore) Setup(ctx context.Context) error

func (*GORMStore) Teardown

func (g *GORMStore) Teardown(ctx context.Context) error

type Store

type Store interface {
	Put(context.Context, string, []byte) error
	Delete(context.Context, string) error
	Get(context.Context, string) ([]byte, error)

	Setup(context.Context) error
	Teardown(context.Context) error
}

type StoreWithKeyPrefix

type StoreWithKeyPrefix struct {
	Store  Store
	Prefix string
}

func (*StoreWithKeyPrefix) Delete

func (s *StoreWithKeyPrefix) Delete(ctx context.Context, k string) error

func (*StoreWithKeyPrefix) Get

func (s *StoreWithKeyPrefix) Get(ctx context.Context, k string) ([]byte, error)

func (*StoreWithKeyPrefix) Put

func (s *StoreWithKeyPrefix) Put(ctx context.Context, k string, v []byte) error

func (*StoreWithKeyPrefix) Setup

func (s *StoreWithKeyPrefix) Setup(ctx context.Context) error

func (*StoreWithKeyPrefix) Teardown

func (s *StoreWithKeyPrefix) Teardown(ctx context.Context) error

type VarStore

type VarStore interface {
	Set(context.Context, []byte) error
	Get(context.Context) ([]byte, error)
}

func NewVarStore

func NewVarStore(s Store, n string) VarStore

Jump to

Keyboard shortcuts

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