store

package
v0.2.1-0...-f8427a7 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2019 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package store provides an in-memory key-value store.

Index

Constants

View Source
const (
	DEBUG   string = "DEBUG"
	INFO    string = "INFO"
	WARNING string = "WARN"
	ERROR   string = "ERROR"
	FATAL   string = "FATAL"
)

Log Levels

Variables

This section is empty.

Functions

This section is empty.

Types

type InMemory

type InMemory struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

InMemory store is thread-safe and handles any object implemented as a Keyer

func (*InMemory) Get

func (db *InMemory) Get(k string) (Keyer, error)

Get retrieves a value

func (*InMemory) Put

func (db *InMemory) Put(v Keyer) error

Put stores a value

func (*InMemory) Remove

func (db *InMemory) Remove(k string) error

Remove a value

func (*InMemory) Search

func (db *InMemory) Search(q string) ([]Keyer, error)

Search on keys

type Keyer

type Keyer interface {
	Key() string
}

Keyer is an object that can be kept in an InMemory store

Jump to

Keyboard shortcuts

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