Documentation
¶
Overview ¶
this file was generated by "go generate" please do not edit
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrRecoverable = errors.New("")
ErrRecoverable is a marker used when handling panics. If the error is wrapped in ErrRecoverable defer handle.Error will recover The most common way to use ErrRecoverable is to call the Throw method
Functions ¶
Types ¶
type Error ¶
func (Error[T]) Deconstruct ¶ added in v0.5.0
Deconstruct implements Result[T].Deconstruct()
type None ¶
type None[T any] struct { }
None represents an Option[T] that does not have a value
func (None[T]) Deconstruct ¶ added in v0.5.0
Deconstruct implements Option[T].Deconstruct
type Ok ¶
type Ok[T any] struct { Value T }
func (Ok[T]) Deconstruct ¶ added in v0.5.0
Deconstruct implements Result[T].Deconstruct
type Option ¶
type Option[T any] interface { // Deconstruct returns Value, true if the underlying type is Some // returns Default, false if the underlying type is None Deconstruct() (T, bool) // IsSome returns true if the underlying type is Some IsSome() bool // IsNone returns true if the underlying type is None IsNone() bool // Unwrap unwraps the Option to its underlying value if the type is Some and // panics if the type is None Unwrap() T // UnwrapOr unwraps the Option if it is Some[T]. If the option is None[T] the supplied value 'other' is returned. UnwrapOr(other T) T // contains filtered or unexported methods }
Option represents a value or nothing
type Result ¶
type Result[T any] interface { // Deconstruct expands the result to its underlying values. // if the result is an error, T contains the zero value. Deconstruct() (T, error) // IsOk returns true for Ok results, false for Error results. IsOk() bool // IsError returns false for Ok results, true for Error results. // IsError returns true for Error results where the err list is empty // IsError returns false for Error results where the err list has at least one error that doesn't match errors.Is // IsError returns true for Error results where the err list has at least one error that matches errors.Is IsError(err ...error) bool // Unwrap attempts to unwrap the result to its value. // If the result is an Error, Unwrap will panic. // Unwrap is meant to be used with handle.Error(*types.Result) Unwrap() T // MapError maps the error to another error // The function is meant to reduce if err != nil boilerplate and allows the user to add additioanl error information MapError(func(error) error) Result[T] // contains filtered or unexported methods }
Result represents a value or an error
func Cast ¶
Cast pereforms a type assertion on the given source to the target type. If the type assertion succeeds, Ok[Target] is returned. If the type assertion fails, Error[TTarget] is returned.
func Castf ¶
Castf pereforms a type assertion on the given source to the target type. If the type assertion succeeds, Ok[Target] is returned. If the type assertion fails, Error[TTarget] with the giiven message is returned.
type Some ¶
type Some[T any] struct { Value T }
func (Some[T]) Deconstruct ¶ added in v0.5.0
Deconstruct implements Option[T].Deconstruct()
type Tuple10 ¶ added in v0.4.3
type Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 any] struct { Value1 T1 Value2 T2 Value3 T3 Value4 T4 Value5 T5 Value6 T6 Value7 T7 Value8 T8 Value9 T9 Value10 T10 }
func NewTuple10 ¶ added in v0.4.3
func (Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]) Deconstruct ¶ added in v0.4.3
func (t Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]) Deconstruct() (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)
type Tuple11 ¶ added in v0.4.3
type Tuple11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11 any] struct { Value1 T1 Value2 T2 Value3 T3 Value4 T4 Value5 T5 Value6 T6 Value7 T7 Value8 T8 Value9 T9 Value10 T10 Value11 T11 }
func NewTuple11 ¶ added in v0.4.3
func (Tuple11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11]) Deconstruct ¶ added in v0.4.3
func (t Tuple11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11]) Deconstruct() (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
type Tuple12 ¶ added in v0.4.3
type Tuple12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12 any] struct { Value1 T1 Value2 T2 Value3 T3 Value4 T4 Value5 T5 Value6 T6 Value7 T7 Value8 T8 Value9 T9 Value10 T10 Value11 T11 Value12 T12 }
func NewTuple12 ¶ added in v0.4.3
func (Tuple12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12]) Deconstruct ¶ added in v0.4.3
func (t Tuple12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12]) Deconstruct() (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)
type Tuple13 ¶ added in v0.4.3
type Tuple13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13 any] struct { Value1 T1 Value2 T2 Value3 T3 Value4 T4 Value5 T5 Value6 T6 Value7 T7 Value8 T8 Value9 T9 Value10 T10 Value11 T11 Value12 T12 Value13 T13 }
func NewTuple13 ¶ added in v0.4.3
func (Tuple13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13]) Deconstruct ¶ added in v0.4.3
func (t Tuple13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13]) Deconstruct() (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)
type Tuple14 ¶ added in v0.4.3
type Tuple14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 any] struct { Value1 T1 Value2 T2 Value3 T3 Value4 T4 Value5 T5 Value6 T6 Value7 T7 Value8 T8 Value9 T9 Value10 T10 Value11 T11 Value12 T12 Value13 T13 Value14 T14 }
func NewTuple14 ¶ added in v0.4.3
func (Tuple14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14]) Deconstruct ¶ added in v0.4.3
func (t Tuple14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14]) Deconstruct() (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)
type Tuple15 ¶ added in v0.4.3
type Tuple15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 any] struct { Value1 T1 Value2 T2 Value3 T3 Value4 T4 Value5 T5 Value6 T6 Value7 T7 Value8 T8 Value9 T9 Value10 T10 Value11 T11 Value12 T12 Value13 T13 Value14 T14 Value15 T15 }
func NewTuple15 ¶ added in v0.4.3
func (Tuple15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15]) Deconstruct ¶ added in v0.4.3
func (t Tuple15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15]) Deconstruct() (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)
type Tuple16 ¶ added in v0.4.3
type Tuple16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16 any] struct { Value1 T1 Value2 T2 Value3 T3 Value4 T4 Value5 T5 Value6 T6 Value7 T7 Value8 T8 Value9 T9 Value10 T10 Value11 T11 Value12 T12 Value13 T13 Value14 T14 Value15 T15 Value16 T16 }
func NewTuple16 ¶ added in v0.4.3
func (Tuple16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16]) Deconstruct ¶ added in v0.4.3
func (t Tuple16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16]) Deconstruct() (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16)
type Tuple2 ¶
type Tuple2[T1, T2 any] struct { Value1 T1 Value2 T2 }
func (Tuple2[T1, T2]) Deconstruct ¶
func (t Tuple2[T1, T2]) Deconstruct() (T1, T2)
type Tuple3 ¶
type Tuple3[T1, T2, T3 any] struct { Value1 T1 Value2 T2 Value3 T3 }
func (Tuple3[T1, T2, T3]) Deconstruct ¶
func (t Tuple3[T1, T2, T3]) Deconstruct() (T1, T2, T3)
type Tuple4 ¶
type Tuple4[T1, T2, T3, T4 any] struct { Value1 T1 Value2 T2 Value3 T3 Value4 T4 }
func (Tuple4[T1, T2, T3, T4]) Deconstruct ¶
func (t Tuple4[T1, T2, T3, T4]) Deconstruct() (T1, T2, T3, T4)
type Tuple5 ¶ added in v0.4.3
type Tuple5[T1, T2, T3, T4, T5 any] struct { Value1 T1 Value2 T2 Value3 T3 Value4 T4 Value5 T5 }
func (Tuple5[T1, T2, T3, T4, T5]) Deconstruct ¶ added in v0.4.3
func (t Tuple5[T1, T2, T3, T4, T5]) Deconstruct() (T1, T2, T3, T4, T5)
type Tuple6 ¶ added in v0.4.3
type Tuple6[T1, T2, T3, T4, T5, T6 any] struct { Value1 T1 Value2 T2 Value3 T3 Value4 T4 Value5 T5 Value6 T6 }
func (Tuple6[T1, T2, T3, T4, T5, T6]) Deconstruct ¶ added in v0.4.3
func (t Tuple6[T1, T2, T3, T4, T5, T6]) Deconstruct() (T1, T2, T3, T4, T5, T6)
type Tuple7 ¶ added in v0.4.3
type Tuple7[T1, T2, T3, T4, T5, T6, T7 any] struct { Value1 T1 Value2 T2 Value3 T3 Value4 T4 Value5 T5 Value6 T6 Value7 T7 }
func (Tuple7[T1, T2, T3, T4, T5, T6, T7]) Deconstruct ¶ added in v0.4.3
func (t Tuple7[T1, T2, T3, T4, T5, T6, T7]) Deconstruct() (T1, T2, T3, T4, T5, T6, T7)
type Tuple8 ¶ added in v0.4.3
type Tuple8[T1, T2, T3, T4, T5, T6, T7, T8 any] struct { Value1 T1 Value2 T2 Value3 T3 Value4 T4 Value5 T5 Value6 T6 Value7 T7 Value8 T8 }
func (Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]) Deconstruct ¶ added in v0.4.3
func (t Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]) Deconstruct() (T1, T2, T3, T4, T5, T6, T7, T8)
type Tuple9 ¶ added in v0.4.3
type Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9 any] struct { Value1 T1 Value2 T2 Value3 T3 Value4 T4 Value5 T5 Value6 T6 Value7 T7 Value8 T8 Value9 T9 }
func (Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]) Deconstruct ¶ added in v0.4.3
func (t Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]) Deconstruct() (T1, T2, T3, T4, T5, T6, T7, T8, T9)