store

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package store implements a simple key-value store.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyExists      = errors.New("store: key already exists")
	ErrKeyDoesntExist = errors.New("store: key does not exist")
)

Functions

This section is empty.

Types

type MemStore

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

func (*MemStore) Delete

func (m *MemStore) Delete(key string) error

Delete removes the specified key and value.

func (*MemStore) Get

func (m *MemStore) Get(key string) (interface{}, error)

Get is used to get a value from a key.

func (*MemStore) Set

func (m *MemStore) Set(key string, value interface{}) error

Set is used to set a value to a key.

func (*MemStore) Update

func (m *MemStore) Update(key string, value interface{}) error

Update can be used to change the value for a given key.

type Store

type Store interface {
	Set(key string, value interface{}) error
	Get(key string) (interface{}, error)
	Delete(key string) error
	Update(key string, newValue interface{}) error
}

func NewMemStore

func NewMemStore() Store

Jump to

Keyboard shortcuts

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