pack

package module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2022 License: MIT Imports: 5 Imported by: 0

README

pack

Store your stuff.

Documentation

Index

Constants

View Source
const ErrThingDoesNotExist = Error("thing does not exist")

Variables

This section is empty.

Functions

This section is empty.

Types

type Error added in v0.6.0

type Error string

func (Error) Error added in v0.6.0

func (pe Error) Error() string

type KVPack added in v0.4.0

type KVPack struct {
	sync.Mutex
	// contains filtered or unexported fields
}

KVPack is a simple key/value store to pack stuff in.

func (*KVPack) Delete added in v0.4.0

func (k *KVPack) Delete(location, name string) error

func (*KVPack) Get added in v0.4.0

func (k *KVPack) Get(location, name string) ([]byte, error)

func (*KVPack) List added in v0.4.0

func (k *KVPack) List(location string) ([]string, error)

func (*KVPack) ListMeta added in v0.5.0

func (k *KVPack) ListMeta(location string) ([]interface{}, error)

func (*KVPack) Save added in v0.4.0

func (k *KVPack) Save(location string, thing Packable) error

Save will pack the provided thing in the location specified using the name as it's key.

type Pack added in v0.4.0

type Pack interface {
	Save(location string, thing Packable) error
	Get(location, name string) ([]byte, error)
	Delete(location, name string) error
	List(location string) ([]string, error)
	ListMeta(location string) ([]interface{}, error)
}

Pack is a place to store things.

func New

func New(dbLocation string) Pack

New creates a new KVPack for storing things.

type Packable added in v0.4.0

type Packable interface {
	Pack() (string, []byte)
	Unpack([]byte)
}

Packable is something that can be stored in a Pack.

Jump to

Keyboard shortcuts

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