store

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const ErrNotFound = Error("value not found in store")

Variables

This section is empty.

Functions

func GetIgnoreErrors

func GetIgnoreErrors(g Getter) func() string

func GetOrPanic

func GetOrPanic(g Getter) func() string

GetOrPanic curries the result of a Getter invocation: the returned func only ever returns the string component when the error component of the underlying Get() call is nil. If Get() generates an error then the curried func panics.

func SetOrPanic

func SetOrPanic(s Setter) func(v string)

SetOrPanic curries the result of a Setter invocation: the returned func only ever returns normally when the error component of the underlying Set() call is nil. If Set() generates an error then the curried func panics.

Types

type Error

type Error string

func (Error) Error

func (err Error) Error() string

type GetFunc

type GetFunc func() (string, error)

func (GetFunc) Get

func (f GetFunc) Get() (string, error)

type GetFuncDecorator

type GetFuncDecorator func(Getter, string, error) (string, error)

func DoGet

func DoGet() GetFuncDecorator

func (GetFuncDecorator) AndThen

func (GetFuncDecorator) Decorate

func (f GetFuncDecorator) Decorate(s Singleton) Singleton

type Getter

type Getter interface {
	Get() (string, error)
}

type SetFunc

type SetFunc func(string) error

func (SetFunc) Set

func (f SetFunc) Set(s string) error

type SetFuncDecorator

type SetFuncDecorator func(Setter, string, error) error

func DoSet

func DoSet() SetFuncDecorator

func (SetFuncDecorator) AndThen

func (SetFuncDecorator) Decorate

func (f SetFuncDecorator) Decorate(s Singleton) Singleton

type Setter

type Setter interface {
	Set(string) error
}

type Singleton

type Singleton interface {
	Getter
	Setter
}

Singleton is a thread-safe abstraction to load and store a string

func DecorateSingleton

func DecorateSingleton(s Singleton, ds ...SingletonDecorator) Singleton

func NewInMemorySingleton

func NewInMemorySingleton() Singleton

type SingletonAdapter

type SingletonAdapter struct {
	GetFunc
	SetFunc
}

type SingletonDecorator

type SingletonDecorator interface {
	Decorate(Singleton) Singleton
}

Jump to

Keyboard shortcuts

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