gomap

package
v0.0.0-...-c59394f Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Incrementer

type Incrementer struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Incrementer implements the models.Incrementer interface

func NewIncrementer

func NewIncrementer(kv *KV) *Incrementer

NewIncrementer returns a new Incrementer

func (*Incrementer) Increment

func (i *Incrementer) Increment(key string, size int) (int64, error)

Increment implements the models.Incrementer

type KV

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

KV use a map as a K/V database

func New

func New() *KV

New returns a new KV

func (*KV) Append

func (k *KV) Append(key, value string) (err error)

Append appends the value for the key

func (*KV) Delete

func (k *KV) Delete(key string) (err error)

Delete delete the item for the key

func (*KV) Get

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

Get gets the value and existence for the key

func (*KV) Put

func (k *KV) Put(key, value string) (err error)

Put puts the value for the key

Jump to

Keyboard shortcuts

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