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