trier

package
v1.0.37 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Try

type Try[T any] struct {
	Value T     `json:"value"`
	Err   error `json:"error"`
}

func CompleteErr added in v1.0.33

func CompleteErr[T any](result T, err error) Try[T]

func CompleteFn added in v1.0.33

func CompleteFn[T comparable](result T, fn func(v T) bool, err error) Try[optioner.Option[T]]

func CompletePtr added in v1.0.33

func CompletePtr[T any](result *T, err error) Try[optioner.Option[T]]

func CompleteSlice added in v1.0.33

func CompleteSlice[T any](result []T, err error) Try[optioner.Option[[]T]]

func CompleteZero added in v1.0.33

func CompleteZero[T comparable](result T, err error) Try[optioner.Option[T]]

func Failure

func Failure[T any](err error) Try[T]

func Failuref

func Failuref[T any](format string, a ...any) Try[T]

func Run added in v1.0.34

func Run[T any](try Try[T], fn func(T) Try[T]) Try[T]

func Success

func Success[T any](result T) Try[T]

func (Try[T]) Error

func (t Try[T]) Error() string

func (Try[T]) Failed

func (t Try[T]) Failed() bool

func (Try[T]) Run added in v1.0.34

func (t Try[T]) Run(fn func(T) Try[T]) Try[T]

func (Try[T]) Succeeded

func (t Try[T]) Succeeded() bool

Jump to

Keyboard shortcuts

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