types

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 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]) Or added in v0.0.9

func (err Error[T]) Or(value T) Result[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]) TryError added in v0.0.9

func (err Error[T]) TryError() error

func (Error[T]) TryValue added in v0.0.9

func (err Error[T]) TryValue() 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]) Or added in v0.0.9

func (nothing Nothing[T]) Or(value T) Option[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]) TryValue added in v0.0.9

func (Nothing[T]) TryValue() 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 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]) Or added in v0.0.9

func (ok OK[T]) Or(T) Result[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]) TryError added in v0.0.9

func (ok OK[T]) TryError() error

func (OK[T]) TryValue added in v0.0.9

func (ok OK[T]) TryValue() 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]
	Or(value T) Option[T]
	TryValue() T
	// contains filtered or unexported methods
}

type OptionIsNothingError added in v0.0.9

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

func NewOptionsIsNothingError added in v0.0.9

func NewOptionsIsNothingError() OptionIsNothingError

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]
	Or(value T) Result[T]
	TryValue() T
	TryError() error
	// contains filtered or unexported methods
}

type ResultIsErrorError added in v0.0.9

type ResultIsErrorError struct {
	Err error
	// contains filtered or unexported fields
}

func NewResultIsErrorError added in v0.0.9

func NewResultIsErrorError(err error) ResultIsErrorError

type ResultIsOkError added in v0.0.9

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

func NewResultIsOkError added in v0.0.9

func NewResultIsOkError() ResultIsOkError

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]) Or added in v0.0.9

func (value Value[T]) Or(T) Option[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]) TryValue added in v0.0.9

func (value Value[T]) TryValue() 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