pkvstore

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, p, k string, v interface{}) error

func PutJSON

func PutJSON(ctx context.Context, s Store, p, 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, p, k string) error

func (*FSStore) Get

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

func (*FSStore) List

func (f *FSStore) List(_ context.Context, p string) ([]string, error)

func (*FSStore) Put

func (f *FSStore) Put(_ context.Context, p, 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, p, k string) error

func (*GORMStore) Get

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

func (*GORMStore) List

func (g *GORMStore) List(ctx context.Context, p string) ([]string, error)

func (*GORMStore) Put

func (g *GORMStore) Put(ctx context.Context, p, 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, string, []byte) error
	Delete(context.Context, string, string) error
	Get(context.Context, string, string) ([]byte, error)
	List(context.Context, string) ([]string, error)

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

Jump to

Keyboard shortcuts

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