trier

package
v1.0.31 Latest Latest
Warning

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

Go to latest
Published: May 10, 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 Complete

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

func CompleteOfFn added in v1.0.27

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

func CompleteOfPtr added in v1.0.27

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

func CompleteOfSlice added in v1.0.27

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

func CompleteOfZero added in v1.0.27

func CompleteOfZero[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 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]) 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