creational

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Construct

func Construct[
	O Object,
	FO Option[O] | OptionFunc[O],
](
	obj O,
	opts ...FO,
) (O, error)

func ConstructWithContext

func ConstructWithContext[
	O Object,
	FO OptionWithContext[O] | OptionFuncWithContext[O],
](
	ctx context.Context,
	obj O,
	opts ...FO,
) (O, error)

func MustConstruct

func MustConstruct[
	O Object,
	FO Option[O] | OptionFunc[O],
](
	obj O,
	opts ...FO,
) O

func MustNew

func MustNew[
	O Object,
	FO Option[O] | OptionFunc[O],
](
	opts ...FO,
) O

func New

func New[
	O Object,
	FO Option[O] | OptionFunc[O],
](
	opts ...FO,
) (O, error)

func NewWithContext

func NewWithContext[
	O Object,
	FO OptionWithContext[O] | OptionFuncWithContext[O],
](
	ctx context.Context,
	opts ...FO,
) (O, error)

Types

type Object

type Object interface{ any }

type Option

type Option[O Object] func(*O) error

type OptionFunc

type OptionFunc[O Object] interface {
	~func(*O) error
}

type OptionFuncWithContext

type OptionFuncWithContext[O Object] interface {
	~func(context.Context, *O) error
}

type OptionWithContext

type OptionWithContext[O Object] func(context.Context, *O) error

Jump to

Keyboard shortcuts

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