opt

package
v0.14.5 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider[T any] func(T) error

Provider is a function type for building functional arguments, and is used for the parallel processing tools in the wpa, srv, and pubsub packages.

The type T should always be mutable (e.g. a map, or a pointer).

func Join

func Join[T any](op ...Provider[T]) Provider[T]

Join takes a zero or more providers and produces a single combined provider. With zero or nil arguments, the operation becomes a noop.

func New

func New[T any](in func(T) error) Provider[T]

New constructs a new Provider, essentially for type casting purposes.

func (Provider[T]) Apply

func (op Provider[T]) Apply(in T) (err error)

Apply applies the current Operation Provider to the configuration, and if the type T implements a Validate() method, calls that. All errors are aggregated.

func (Provider[T]) Build

func (op Provider[T]) Build(conf T) (out T, err error)

Build processes a configuration object, returning a modified version (or a zero value, in the case of an error).

func (Provider[T]) Join

func (op Provider[T]) Join(opps ...Provider[T]) Provider[T]

Join aggregates a collection of Option Providers into a single option provider. The amalgamated operation is panic safe and omits all nil providers.

Jump to

Keyboard shortcuts

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