go-micro: github.com/micro/go-micro/config/options Index | Files

package options

import "github.com/micro/go-micro/config/options"

Package options provides a way to initialise options

Index

Package Files

default.go options.go

type Option Uses

type Option func(o *Values) error

Option gives access to options

func WithOption Uses

func WithOption(o Option) Option

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

func WithString Uses

func WithString(s string) Option

String sets the string

func WithValue Uses

func WithValue(k, v interface{}) Option

WithValue allows you to set any value within the options

type Options Uses

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 Uses

func NewOptions(opts ...Option) Options

NewOptions returns a new initialiser

type Values Uses

type Values struct {
    sync.RWMutex
    // contains filtered or unexported fields
}

Values holds the set of option values and protects them

func (*Values) Get Uses

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

Get a value from options

func (*Values) Option Uses

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

SetOption executes an option

func (*Values) Set Uses

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

Set a value in the options

Package options imports 2 packages (graph) and is imported by 27 packages. Updated 2020-01-21. Refresh now. Tools for package owners.