options

package
v4.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: Apache-2.0 Imports: 6 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Address   = NewOption("Address")
	Name      = NewOption("Name")
	Broker    = NewOption("Broker")
	Logger    = NewOption("Logger")
	Meter     = NewOption("Meter")
	Tracer    = NewOption("Tracer")
	Store     = NewOption("Store")
	Register  = NewOption("Register")
	Router    = NewOption("Router")
	Codec     = NewOption("Codec")
	Codecs    = NewOption("Codecs")
	Client    = NewOption("Client")
	Context   = NewOption("Context")
	TLSConfig = NewOption("TLSConfig")
	Metadata  = NewOption("Metadata")
	Timeout   = NewOption("Timeout")
)

Functions

func Apply added in v4.1.0

func Apply(src interface{}, opts ...Option) error

Apply assign options to struct src

func NewOption added in v4.1.0

func NewOption(name string) func(...interface{}) Option

NewOption create new option with name

func SetValueByPath added in v4.1.0

func SetValueByPath(src interface{}, dst interface{}, path string) error

SetValueByPath set src struct field to val dst via path

Types

type Hook

type Hook interface{}

Hook func interface

type Hooks

type Hooks []Hook

Hooks func slice

func (*Hooks) Append

func (hs *Hooks) Append(h ...Hook)

Append is used to add hooks

func (*Hooks) EachNext

func (hs *Hooks) EachNext(fn func(Hook))

EachNext is used to itearate over hooks forward

func (*Hooks) EachPrev

func (hs *Hooks) EachPrev(fn func(Hook))

EachPrev is used to iterate over hooks backward

func (*Hooks) Replace

func (hs *Hooks) Replace(h ...Hook)

Replace is used to set hooks

type Option added in v4.0.6

type Option func(interface{}) error

Option func signature

type Validator added in v4.1.0

type Validator interface {
	// Validate returns nil, if all options are correct,
	// otherwise returns an error explaining the mistake
	Validate() error
}

Options interface must be used by all options

Jump to

Keyboard shortcuts

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