results

package
v0.0.0-...-d2d06f5 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2018 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DummyIntValue

type DummyIntValue struct{}

DummyIntValue contains nothing

func (DummyIntValue) Int

func (div DummyIntValue) Int() int

Int returns 0

type ErrorResult

type ErrorResult struct {
	From Result
	Err  error
}

ErrorResult contains an error and reference to another result

func (ErrorResult) Error

func (er ErrorResult) Error() error

Error returns the erro that is wrapped

func (ErrorResult) ValueOfProperty

func (er ErrorResult) ValueOfProperty(property string) (Value, error)

ValueOfProperty is a dummy to fulfill Result interface

type IntValue

type IntValue struct {
	V int
}

IntValue represents an int

func (IntValue) Int

func (iv IntValue) Int() int

Int returns the int value that was initialized

func (IntValue) String

func (iv IntValue) String() string

String returns the string representation of the original int

type NamedResult

type NamedResult struct {
	Name string

	Result
}

NamedResult has a result with string identifier

type Override

type Override struct {
	FromState     string `mapstructure:"from_state"`
	UsingProperty string `mapstructure:"using_property"`
	ToReplace     string `mapstructure:"to_replace"`
}

Override using results

func (Override) Apply

func (o Override) Apply(rs Results, src string) (string, error)

Apply an override by fetching a result

type Result

type Result interface {
	Error() error
	ValueOfProperty(property string) (Value, error)
}

Result interface can identify errors, or fetch values based on string identifiers

type Results

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

Results collection of results

func New

func New(nrs ...NamedResult) *Results

New results collection

func (*Results) Add

func (rs *Results) Add(r NamedResult)

Add a result

func (*Results) Get

func (rs *Results) Get(k string) (Result, error)

Get a result by name

type StringValue

type StringValue struct {
	DummyIntValue

	V string
}

StringValue contains a string

func (StringValue) String

func (sv StringValue) String() string

String returns the initialized string

type Value

type Value interface {
	Int() int
	String() string
}

Value can return an Int() or String() value

Jump to

Keyboard shortcuts

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