storage

package
v0.0.0-...-c372385 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2014 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MarshalFunc

type MarshalFunc func(v interface{}) ([]byte, error)

MarshalFunc converts an interface to bytes that can be stored.

type Storage

type Storage struct {
	Backend   backend.Backend
	Marshal   MarshalFunc
	Unmarshal UnmarshalFunc
}

Storage ...

func New

New initializes a new Storage backend.

func NewJSON

func NewJSON(b backend.Backend) *Storage

NewJSON (un)marshals interfaces to and from JSON.

func (*Storage) Delete

func (s *Storage) Delete(key string) error

Delete removes a key from the storage.

func (*Storage) Get

func (s *Storage) Get(key string, v interface{}) (err error)

Get returns the value for a key.

func (*Storage) Has

func (s *Storage) Has(key string) bool

Has checks if the given key has been defined.

func (*Storage) Scan

func (s *Storage) Scan(prefix string) <-chan string

Scan returns all keys found with prefix, in no particular order.

func (*Storage) Set

func (s *Storage) Set(key string, v interface{}) (err error)

Set stores the value for a key.

type UnmarshalFunc

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

UnmarshalFunc coverts stored bytes to an interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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