Version: v1.18.0 Latest Latest

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

Go to latest
Published: Dec 8, 2019 License: Apache-2.0 Imports: 2 Imported by: 57



Package options provides a way to initialise options



This section is empty.


This section is empty.


This section is empty.


type Option

type Option func(o *Values) error

Option gives access to options

func WithOption

func WithOption(o Option) Option

WithOption gives you the ability to create an option that accesses values

func WithString

func WithString(s string) Option

String sets the string

func WithValue

func WithValue(k, v interface{}) Option

WithValue allows you to set any value within the options

type Options

type Options interface {
	// Initialise options
	Init(...Option) error
	// Options returns the current options
	Values() *Values
	// The name for who these options exist
	String() string

Options is used for initialisation

func NewOptions

func NewOptions(opts ...Option) Options

NewOptions returns a new initialiser

type Values

type Values struct {
	// contains filtered or unexported fields

Values holds the set of option values and protects them

func (*Values) Get

func (o *Values) Get(k interface{}) (interface{}, bool)

Get a value from options

func (*Values) Option

func (o *Values) Option(op Option) error

SetOption executes an option

func (*Values) Set

func (o *Values) Set(k, v interface{}) error

Set a value in the options

Jump to

Keyboard shortcuts

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