results

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrResultNilError = errors.New("error is nil")
	ErrResultHasError = errors.New("result has error")
)

Functions

func Must

func Must[T any](value T, err error) T

Types

type Result

type Result[T any] struct {
	// contains filtered or unexported fields
}

func Err

func Err[T any](err error) Result[T]

func From

func From[T any](value T, err error) Result[T]

func Ok

func Ok[T any](value T) Result[T]

func (Result[T]) Err

func (r Result[T]) Err() error

func (Result[T]) Get

func (r Result[T]) Get() T

func (Result[T]) IsErr

func (r Result[T]) IsErr() bool

func (Result[T]) IsOk

func (r Result[T]) IsOk() bool

func (Result[T]) OrElse

func (r Result[T]) OrElse(other T) T

func (Result[T]) OrEmpty

func (r Result[T]) OrEmpty() T

func (Result[T]) Unpack

func (r Result[T]) Unpack() (T, error)

Jump to

Keyboard shortcuts

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