opt

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 2 Imported by: 4 modules, 3 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

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