Result

package
v0.0.0-...-ee6ab61 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	Payload() interface{}
	HasError() bool
	Error() Error.Interface
}

func Err

func Err(err Error.Interface) Interface

Err is the direct, allocation-lean equivalent of New(WithError(err)): a failure Result carrying err over a null payload, built without the functional-options closure or variadic slice.

func New

func New(options ...Option) Interface

func Ok

func Ok(payload interface{}) Interface

Ok is the direct, allocation-lean equivalent of New(WithPayload(payload)): a success Result (no error) carrying payload, built without the functional-options closure or variadic slice. The two boolean payloads are interned — Ok(true) and Ok(false) return shared immutable singletons and allocate nothing.

type Option

type Option func(*data)

func WithError

func WithError(error Error.Interface) Option

Functional parameter to set the result error.

func WithPayload

func WithPayload(payload interface{}) Option

Functional parameter to set the result payload.

Jump to

Keyboard shortcuts

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