Documentation ¶
Index ¶
- func IsBlank(value interface{}) bool
- type AnyResult
- func (self AnyResult[T]) And(res Result[T]) Result[T]
- func (self AnyResult[T]) AndThen(op func(T) Result[T]) Result[T]
- func (self AnyResult[T]) Contains(val T) bool
- func (self AnyResult[T]) Err() error
- func (self AnyResult[T]) Expect(msg string) T
- func (self AnyResult[T]) ExpectErr(msg string) error
- func (self AnyResult[T]) IsErr() bool
- func (self AnyResult[T]) IsOk() bool
- func (self AnyResult[T]) Ok() Option[T]
- func (self AnyResult[T]) Or(res Result[T]) Result[T]
- func (self AnyResult[T]) OrElse(op func(error) Result[T]) Result[T]
- func (self AnyResult[T]) String() string
- func (self AnyResult[T]) Unwrap() T
- func (self AnyResult[T]) UnwrapOr(val T) T
- type ErrArgument
- type ErrMultipleVariadicArguments
- type FutureResult
- func (self FutureResult[T]) And(res Result[T]) Result[T]
- func (self FutureResult[T]) AndThen(op func(T) Result[T]) Result[T]
- func (self FutureResult[T]) Contains(val T) bool
- func (self FutureResult[T]) Err() error
- func (self FutureResult[T]) Expect(msg string) T
- func (self FutureResult[T]) ExpectErr(msg string) error
- func (self FutureResult[T]) IsErr() bool
- func (self FutureResult[T]) IsOk() bool
- func (self FutureResult[T]) Ok() Option[T]
- func (self FutureResult[T]) Or(res Result[T]) Result[T]
- func (self FutureResult[T]) OrElse(op func(error) Result[T]) Result[T]
- func (self FutureResult[T]) Unwrap() T
- func (self FutureResult[T]) UnwrapOr(val T) T
- type Hash
- type HashArrayConverter
- type HashConverter
- type Initializer
- type Option
- type Result
- type Slice
- type Str
- type StringSlice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AnyResult ¶
type AnyResult[T comparable] struct { // contains filtered or unexported fields }
func Err ¶
func Err[T comparable](err error) AnyResult[T]
func ErrText ¶
func ErrText[T comparable](text string) AnyResult[T]
func Ok ¶
func Ok[T comparable](val T) AnyResult[T]
func Return ¶
func Return[T comparable](val T, err error) AnyResult[T]
func (AnyResult[T]) And ¶
And returns res if the result is Ok, otherwise returns the Err value of self.
func (AnyResult[T]) AndThen ¶
AndThen calls op if the result is Ok, otherwise returns the Err value of self.
func (AnyResult[T]) Or ¶
Or returns res if the result is Err, otherwise returns the Ok value of self.
func (AnyResult[T]) OrElse ¶
OrElse calls op if the result is Err, otherwise retuns the Ok value of self.
type ErrArgument ¶
type ErrArgument struct {
Message string
}
ErrArgument is returned when the arguments are wrong.
func (ErrArgument) Error ¶
func (e ErrArgument) Error() string
Error implements error interafce and return human-readable error message.
type ErrMultipleVariadicArguments ¶
type ErrMultipleVariadicArguments struct {
Name string
}
func (ErrMultipleVariadicArguments) Error ¶
func (e ErrMultipleVariadicArguments) Error() string
type FutureResult ¶
type FutureResult[T comparable] struct { // contains filtered or unexported fields }
func FutureErr ¶
func FutureErr[T comparable](err error) FutureResult[T]
func FutureOk ¶
func FutureOk[T comparable](val T) FutureResult[T]
func (FutureResult[T]) And ¶
func (self FutureResult[T]) And(res Result[T]) Result[T]
func (FutureResult[T]) AndThen ¶
func (self FutureResult[T]) AndThen(op func(T) Result[T]) Result[T]
func (FutureResult[T]) Contains ¶
func (self FutureResult[T]) Contains(val T) bool
func (FutureResult[T]) Err ¶
func (self FutureResult[T]) Err() error
func (FutureResult[T]) Expect ¶
func (self FutureResult[T]) Expect(msg string) T
func (FutureResult[T]) ExpectErr ¶
func (self FutureResult[T]) ExpectErr(msg string) error
func (FutureResult[T]) IsErr ¶
func (self FutureResult[T]) IsErr() bool
func (FutureResult[T]) IsOk ¶
func (self FutureResult[T]) IsOk() bool
func (FutureResult[T]) Ok ¶
func (self FutureResult[T]) Ok() Option[T]
func (FutureResult[T]) Or ¶
func (self FutureResult[T]) Or(res Result[T]) Result[T]
func (FutureResult[T]) OrElse ¶
func (self FutureResult[T]) OrElse(op func(error) Result[T]) Result[T]
func (FutureResult[T]) Unwrap ¶
func (self FutureResult[T]) Unwrap() T
func (FutureResult[T]) UnwrapOr ¶
func (self FutureResult[T]) UnwrapOr(val T) T
type Hash ¶
type Hash map[string]interface{}
type HashArrayConverter ¶
type HashArrayConverter interface {
ToHashArray() []Hash
}
type HashConverter ¶
type HashConverter interface {
ToHash() Hash
}
type Initializer ¶
type Initializer interface {
Initialize() error
}
type Result ¶
type Result[T comparable] interface { Ok() Option[T] Err() error IsOk() bool IsErr() bool And(Result[T]) Result[T] AndThen(op func(T) Result[T]) Result[T] Or(Result[T]) Result[T] OrElse(op func(error) Result[T]) Result[T] Contains(val T) bool Unwrap() T UnwrapOr(val T) T Expect(msg string) T ExpectErr(msg string) error }
Result is a type that represents either success (Ok) or failure (Err).
type Str ¶
type Str string
func (Str) IsBlank ¶
IsBlank returns true when string contains only space characters, and false otherwise.
func (Str) IsNotEmpty ¶
type StringSlice ¶
type StringSlice []string
func Strings ¶
func Strings(ss ...string) StringSlice
func (StringSlice) Contains ¶
func (ss StringSlice) Contains(v interface{}) bool
Contains returns true if the slice contains an element with the given value.
func (StringSlice) ToHash ¶
func (ss StringSlice) ToHash() Hash