options

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyOptions

func ApplyOptions[O, C any](options O, callOptions []C) error

ApplyOptions applies all the callOptions to options. options must be a pointer to a struct and callOptions must be a list of objects that implement CallOption.

Types

type CallOption

type CallOption interface {
	Do(any) error
	// contains filtered or unexported methods
}

CallOption implements an optional argument to a method call. See https://blog.devgenius.io/go-call-option-that-can-be-used-with-multiple-methods-6c81734f3dbe for an explanation of the usage pattern.

func NewCallOption

func NewCallOption(f func(any) error) CallOption

NewCallOption returns a new CallOption whose Do() method calls function "f".

Jump to

Keyboard shortcuts

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