options

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option[T any] interface {
	Apply(opts T) error
	LogAttr() slog.Attr
}

Option is a single functional option.

type Options

type Options[T any, O Option[T]] []O

Options is a collection of functional Options.

func Join

func Join[T any, O Option[T]](opts []O) Options[T, O]

Join creates a new Option joining the provided Option values.

The result implements slog.LogValuer, so the following is evaluated lazily:

slog.LogAttrs(ctx, slog.LevelInfo, "settings", Join(opts...).LogAttr())

func (Options[T, _]) Apply

func (o Options[T, _]) Apply(opts T) error

Apply applies each Option in the list.

func (Options[_, _]) LogAttr

func (o Options[_, _]) LogAttr() slog.Attr

LogAttr returns a lazy slog.Attr for logging.

func (Options[T, O]) LogValue

func (o Options[T, O]) LogValue() slog.Value

LogValue implements slog.LogValuer.

Jump to

Keyboard shortcuts

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