kv

package
v0.0.0-...-cc6de57 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(from KV, to KV) error

Types

type Codec

type Codec interface {
	Decode([]byte) (interface{}, error)
	Encode(interface{}) ([]byte, error)
}

type DefaultProvider

type DefaultProvider func(key string) (interface{}, error)

type DirKV

type DirKV struct {
	Path string
}

func (*DirKV) Close

func (dir *DirKV) Close() error

func (*DirKV) Contains

func (dir *DirKV) Contains(key string) bool

func (*DirKV) Get

func (dir *DirKV) Get(prefix string) ([]byte, error)

func (*DirKV) GetOrDefault

func (dir *DirKV) GetOrDefault(key string, defaultFunc Getter) ([]byte, error)

func (*DirKV) GetReader

func (dir *DirKV) GetReader(prefix string) (io.Reader, error)

func (*DirKV) IsChanged

func (dir *DirKV) IsChanged(since time.Time, prefix string) (bool, error)

func (*DirKV) Iterate

func (dir *DirKV) Iterate(prefix string, action IteratorAction) error

func (*DirKV) IterateAll

func (dir *DirKV) IterateAll(action IteratorAction) error

func (*DirKV) IterateSubTree

func (dir *DirKV) IterateSubTree(prefix string, action IteratorAction) error

func (*DirKV) IterateValues

func (dir *DirKV) IterateValues(prefix string, action KeyValueIteratorAction) error

func (*DirKV) List

func (dir *DirKV) List(prefix string) ([]string, error)

func (*DirKV) Put

func (dir *DirKV) Put(key string, value []byte) error

type EncodedKV

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

func NewJsonKV

func NewJsonKV(kv KV) EncodedKV

func (EncodedKV) Contains

func (e EncodedKV) Contains(key string) bool

func (EncodedKV) Get

func (e EncodedKV) Get(prefix string) (interface{}, error)

func (EncodedKV) GetOrDefault

func (e EncodedKV) GetOrDefault(key string, defaultFunc DefaultProvider) (interface{}, error)

func (EncodedKV) GetReader

func (e EncodedKV) GetReader(prefix string) (interface{}, error)

func (EncodedKV) IsChanged

func (e EncodedKV) IsChanged(since time.Time, prefix string) (bool, error)

func (EncodedKV) Iterate

func (e EncodedKV) Iterate(prefix string, action IteratorAction) error

func (EncodedKV) IterateAll

func (e EncodedKV) IterateAll(action IteratorAction) error

func (EncodedKV) IterateSubTree

func (e EncodedKV) IterateSubTree(prefix string, action IteratorAction) error

func (EncodedKV) List

func (e EncodedKV) List(prefix string) ([]string, error)

func (EncodedKV) Put

func (e EncodedKV) Put(key string, value []interface{}) error

type Getter

type Getter func(key string) ([]byte, error)

type IteratorAction

type IteratorAction func(key string) error

type JsonCodec

type JsonCodec struct {
}

func (JsonCodec) Decode

func (j JsonCodec) Decode(bytes []byte) (interface{}, error)

func (JsonCodec) Encode

func (j JsonCodec) Encode(i interface{}) ([]byte, error)

type KV

type KV interface {
	Put(key string, value []byte) error
	List(prefix string) ([]string, error)
	IterateAll(action IteratorAction) error
	Iterate(prefix string, action IteratorAction) error
	IterateValues(prefix string, action KeyValueIteratorAction) error
	IterateSubTree(prefix string, action IteratorAction) error
	Contains(key string) bool
	GetOrDefault(key string, defaultFunc Getter) ([]byte, error)
	Get(prefix string) ([]byte, error)
	GetReader(prefix string) (io.Reader, error)
	IsChanged(since time.Time, prefix string) (bool, error)
	Close() error
}

func Create

func Create(path string) (KV, error)

type KeyValueIteratorAction

type KeyValueIteratorAction func(key string, value []byte) error

type Pebble

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

func CreatePebble

func CreatePebble(dir string) (*Pebble, error)

func (*Pebble) Close

func (pb *Pebble) Close() error

func (*Pebble) Contains

func (pb *Pebble) Contains(key string) bool

func (*Pebble) Get

func (pb *Pebble) Get(prefix string) ([]byte, error)

func (*Pebble) GetOrDefault

func (pb *Pebble) GetOrDefault(key string, defaultFunc Getter) ([]byte, error)

func (*Pebble) GetReader

func (pb *Pebble) GetReader(prefix string) (io.Reader, error)

func (*Pebble) IsChanged

func (pb *Pebble) IsChanged(since time.Time, prefix string) (bool, error)

func (*Pebble) Iterate

func (pb *Pebble) Iterate(prefix string, action IteratorAction) error

func (*Pebble) IterateAll

func (pb *Pebble) IterateAll(action IteratorAction) error

func (*Pebble) IterateSubTree

func (pb *Pebble) IterateSubTree(prefix string, action IteratorAction) error

func (*Pebble) List

func (pb *Pebble) List(prefix string) ([]string, error)

func (*Pebble) Put

func (pb *Pebble) Put(key string, value []byte) error

type SqliteKV

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

func CreateSqliteKV

func CreateSqliteKV(uri string) (*SqliteKV, error)

func (*SqliteKV) Close

func (sql *SqliteKV) Close() error

func (*SqliteKV) Commit

func (s *SqliteKV) Commit() error

func (*SqliteKV) Contains

func (s *SqliteKV) Contains(key string) bool

func (*SqliteKV) ExecQuery

func (s *SqliteKV) ExecQuery(query string, args ...interface{}) error

func (*SqliteKV) Get

func (s *SqliteKV) Get(key string) ([]byte, error)

func (*SqliteKV) GetOrDefault

func (s *SqliteKV) GetOrDefault(key string, defaultFunc Getter) ([]byte, error)

func (*SqliteKV) GetReader

func (s *SqliteKV) GetReader(prefix string) (io.Reader, error)

func (*SqliteKV) IsChanged

func (s *SqliteKV) IsChanged(since time.Time, prefix string) (bool, error)

func (*SqliteKV) Iterate

func (s *SqliteKV) Iterate(prefix string, action IteratorAction) error

func (*SqliteKV) IterateAll

func (s *SqliteKV) IterateAll(action IteratorAction) error

func (*SqliteKV) IterateSubTree

func (s *SqliteKV) IterateSubTree(prefix string, action IteratorAction) error

func (*SqliteKV) IterateValues

func (s *SqliteKV) IterateValues(prefix string, action KeyValueIteratorAction) error

func (*SqliteKV) List

func (s *SqliteKV) List(prefix string) ([]string, error)

func (*SqliteKV) Put

func (s *SqliteKV) Put(key string, value []byte) error

type TypedKV

type TypedKV interface {
	Put(key string, value []interface{}) error
	List(prefix string) ([]string, error)
	IterateAll(action IteratorAction) error
	Iterate(prefix string, action IteratorAction) error
	IterateSubTree(prefix string, action IteratorAction) error
	Contains(key string) bool
	GetOrDefault(key string, defaultFunc DefaultProvider) (interface{}, error)
	Get(prefix string) (interface{}, error)
	GetReader(prefix string) (io.Reader, error)
	IsChanged(since time.Time, prefix string) (bool, error)
}

Jump to

Keyboard shortcuts

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