result

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsErr

func IsErr(res Result) bool

func IsNone

func IsNone(opt Optional) bool

func IsOk

func IsOk(res Result) bool

func IsSome

func IsSome(opt Optional) bool

func Match

func Match(res Result, onOk func(any) any, onErr func(error) any) any

func Unwrap

func Unwrap(opt Optional) any

func UnwrapErr

func UnwrapErr(res Result) error

func UnwrapOr

func UnwrapOr(opt Optional, defaultValue any) any

func UnwrapOrElse

func UnwrapOrElse(res Result, fn func() any) any

func UnwrapOrResult

func UnwrapOrResult(res Result, defaultValue any) any

func UnwrapResult

func UnwrapResult(res Result) any

Types

type Optional

type Optional struct {
	// contains filtered or unexported fields
}

func Filter

func Filter(opt Optional, predicate func(any) bool) Optional

func FlatMap

func FlatMap(opt Optional, transform func(any) Optional) Optional

func Flatten

func Flatten(opt Optional) Optional

func Map

func Map(opt Optional, transform func(any) any) Optional

func None

func None() Optional

func Some

func Some(value any) Optional

func ToOptional

func ToOptional(res Result) Optional

type Result

type Result struct {
	// contains filtered or unexported fields
}

func All

func All(results []Result) Result

func AndThen

func AndThen(res Result, fn func(any) Result) Result

func Any

func Any(results []Result) Result

func Err

func Err(err error) Result

func FlattenResult

func FlattenResult(res Result) Result

func FromOptional

func FromOptional(opt Optional, err error) Result

func MapErr

func MapErr(res Result, transform func(error) error) Result

func MapResult

func MapResult(res Result, transform func(any) any) Result

func Ok

func Ok(value any) Result

func OrElse

func OrElse(res Result, fn func(error) Result) Result

Jump to

Keyboard shortcuts

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