options

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: Apache-2.0 Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package options provides a way to initialise options

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 {
	sync.RWMutex
	// 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