kv

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilConfig = errors.New("config cannot be nil")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Logger logger.Logger
}

type IKV

type IKV interface {
	// Get gets a value from the KV store; bool indicates if value exists
	Get(key string) (string, bool)

	// Set sets a key/value pair in the KV store; return bool indicates if key
	// was overwritten
	Set(key string, value string) bool

	// Delete will delete a key from the KV store; return bool indicates if
	// key existed before deletion
	Delete(key string) bool

	// Exists checks if a key exists in the KV store
	Exists(key string) bool

	// Purge removes all keys from the KV store; return int indicates how many
	// keys were removed.
	Purge() int64

	// Keys returns a slice of all keys in the KV store
	Keys() []string

	// Items returns the number of keys in the KV store
	Items() int64
}

type KV

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

func New

func New(cfg *Config) (*KV, error)

func (*KV) Delete

func (k *KV) Delete(key string) bool

func (*KV) Exists

func (k *KV) Exists(key string) bool

func (*KV) Get

func (k *KV) Get(key string) (string, bool)

func (*KV) Items

func (k *KV) Items() int64

func (*KV) Keys

func (k *KV) Keys() []string

func (*KV) Purge

func (k *KV) Purge() int64

func (*KV) Set

func (k *KV) Set(key string, value string) bool

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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