kv

package
v0.0.0-...-2627f95 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Stream

func Stream(iter *Iterator) stream.Stream

Stream wraps the iterator in a stream whose values are KV instances

Types

type Iterator

type Iterator struct {
	kv.Iterator
	// contains filtered or unexported fields
}

Iterator is like kv.Iterator except it unmarshals values

func (*Iterator) Next

func (iterator *Iterator) Next() bool

Next is like kv.Iterator.Next

func (*Iterator) Value

func (iterator *Iterator) Value() interface{}

Value returns the unmarshaled value at the current iterator position

type KV

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

KV represents a key-value pair whose value has been unmarshaled

func (KV) Key

func (kv KV) Key() []byte

Key returns the key

func (KV) Value

func (kv KV) Value() interface{}

Value returns the value

type Map

type Map struct {
	MapUpdater
	MapReader
}

Map combines MapUpdater and MapReader

type MapReader

type MapReader struct {
	kv.MapReader
	Unmarshal Unmarshaler
}

MapReader is like kv.MapReader except it marshals the values

func (*MapReader) Get

func (m *MapReader) Get(key []byte) (interface{}, error)

Get is like kv.MapReader.Get except it unmarshals the value

func (*MapReader) Keys

func (m *MapReader) Keys(keys keys.Range, order kv.SortOrder) (*Iterator, error)

Keys is like kv.MapReader.Keys except the returned iterator unmarshals values

type MapUpdater

type MapUpdater struct {
	kv.MapUpdater
}

MapUpdater is like kv.MapUpdater except it marshals the values

func (*MapUpdater) Put

func (m *MapUpdater) Put(key []byte, value Marshalable) error

Put is like kv.MapUpdater.Put except it marshals the value

type Marshalable

type Marshalable interface {
	Marshal() ([]byte, error)
}

Marshalable describes a type that can be marshaled to a series of bytes

type Unmarshaler

type Unmarshaler func(data []byte) (interface{}, error)

Unmarshaler is a function that unmarshals bytes into some type

Jump to

Keyboard shortcuts

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