types

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error[T any] struct {
	Err error
}

func (Error[T]) Error

func (err Error[T]) Error(call func(error) Result[T]) Result[T]

func (Error[T]) MustValue added in v0.0.3

func (err Error[T]) MustValue() T

func (Error[T]) String

func (err Error[T]) String() string

func (Error[T]) Then

func (err Error[T]) Then(func(T) Result[T]) Result[T]

func (Error[T]) WhenError

func (err Error[T]) WhenError(call func(error)) Result[T]

func (Error[T]) WhenOK

func (err Error[T]) WhenOK(call func(T)) Result[T]

type Nothing

type Nothing[T any] struct{}

func (Nothing[T]) Else

func (nothing Nothing[T]) Else(call func() Option[T]) Option[T]

func (Nothing[T]) MustValue added in v0.0.3

func (Nothing[T]) MustValue() T

func (Nothing[T]) String

func (Nothing[T]) String() string

func (Nothing[T]) Then

func (nothing Nothing[T]) Then(call func(T) Option[T]) Option[T]

func (Nothing[T]) WhenNothing

func (nothing Nothing[T]) WhenNothing(call func()) Option[T]

func (Nothing[T]) WhenValue

func (nothing Nothing[T]) WhenValue(call func(T)) Option[T]

type NothingError added in v0.0.3

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

func NewNothingError added in v0.0.3

func NewNothingError() NothingError

type OK

type OK[T any] struct {
	Value T
}

func (OK[T]) Error

func (ok OK[T]) Error(func(error) Result[T]) Result[T]

func (OK[T]) MustValue added in v0.0.3

func (ok OK[T]) MustValue() T

func (OK[T]) String

func (ok OK[T]) String() string

func (OK[T]) Then

func (ok OK[T]) Then(call func(T) Result[T]) Result[T]

func (OK[T]) WhenError

func (ok OK[T]) WhenError(func(error)) Result[T]

func (OK[T]) WhenOK

func (ok OK[T]) WhenOK(call func(T)) Result[T]

type Option

type Option[T any] interface {
	Then(call func(T) Option[T]) Option[T]
	Else(call func() Option[T]) Option[T]
	WhenValue(call func(T)) Option[T]
	WhenNothing(call func()) Option[T]
	MustValue() T
	// contains filtered or unexported methods
}

type Result

type Result[T any] interface {
	Then(call func(T) Result[T]) Result[T]
	Error(call func(error) Result[T]) Result[T]
	WhenOK(call func(T)) Result[T]
	WhenError(call func(error)) Result[T]
	MustValue() T
	// contains filtered or unexported methods
}

type Value

type Value[T any] struct {
	This T
}

func (Value[T]) Else

func (value Value[T]) Else(func() Option[T]) Option[T]

func (Value[T]) MustValue added in v0.0.3

func (value Value[T]) MustValue() T

func (Value[T]) String

func (value Value[T]) String() string

func (Value[T]) Then

func (value Value[T]) Then(call func(T) Option[T]) Option[T]

func (Value[T]) WhenNothing

func (value Value[T]) WhenNothing(func()) Option[T]

func (Value[T]) WhenValue

func (value Value[T]) WhenValue(call func(T)) Option[T]

Jump to

Keyboard shortcuts

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