kv

package module
v1.5.9 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: MIT Imports: 5 Imported by: 8

README

KV - Key-Value Store

PkgGoDev Build Status Go Report Card Coverage Status GitHub issues Release

Installation

To install the package, run:

go get github.com/go-zoox/kv

Getting Started

func TestMemoryKV(t *testing.T) {
	m := kv.NewMemory()
	if m.Size() != 0 {
		t.Errorf("Expected size 0, got %d", m.Size())
	}

	m.Set("key", "value")
	if m.Get("key") != "value" {
		t.Error("Expected value to be 'value'")
	}

	if m.Size() != 1 {
		t.Errorf("Expected size 1, got %d", m.Size())
	}
}

Engines

  • Memory
  • Redis
  • MongoDB
  • SQLite
  • FileSystem
  • PostgreSQL
  • MySQL
  • DynamoDB
  • JSONRPC

Inspired by

License

GoZoox is released under the MIT License.

Documentation

Index

Constants

View Source
const ErrConfigNotSet = "%s config not set"

ErrConfigNotSet means config not set error.

View Source
const ErrUnknownEngine = "unknown engine: %s"

ErrUnknownEngine means unknown engine error.

Variables

View Source
var Version = "1.5.9"

Version is the current version of the package.

Functions

This section is empty.

Types

type Config added in v1.4.3

type Config = typing.Config

Config is the interface for KV Config.

type Error added in v1.1.8

type Error struct {
	Type    string
	Message string
}

Error is the error type for KV.

func NewError added in v1.1.5

func NewError(typ string, message string) *Error

NewError returns a new KVError.

func (*Error) Error added in v1.1.8

func (e *Error) Error() string

Error returns the error message.

type KV added in v1.4.0

type KV = typing.KV

KV is the interface for all KV implementations.

func New added in v1.1.5

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

New returns a new KV.

func NewFileSystem added in v1.3.0

func NewFileSystem(cfg ...*fs.FileSystemOptions) (KV, error)

NewFileSystem returns a new FileSystem KV.

func NewMemory

func NewMemory() KV

NewMemory returns a new Memory KV.

func NewRedis

func NewRedis(cfg *redis.Config) (KV, error)

NewRedis returns a new Redis KV.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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