Documentation
¶
Index ¶
- func Match[T, U any](resource Resource[T], onLoading func() U, onError func(error) U, ...) U
- func MatchPartial[T, U any](resource Resource[T], options ...MatchOption[T, U]) maybe.Maybe[U]
- type MatchOption
- type MatchOptions
- type Resource
- func FlatMapData[T, U any](resource Resource[T], fn func(T) Resource[U]) Resource[U]
- func MapData[T, U any](resource Resource[T], fn func(T) U) Resource[U]
- func MapError[T any](resource Resource[T], fn func(error) error) Resource[T]
- func ResourceError[T any](err error) Resource[T]
- func ResourceLoading[T any]() Resource[T]
- func ResourceSuccess[T any](data T) Resource[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MatchPartial ¶
func MatchPartial[T, U any](resource Resource[T], options ...MatchOption[T, U]) maybe.Maybe[U]
Types ¶
type MatchOption ¶
type MatchOption[T, U any] func(*MatchOptions[T, U])
func WithDefault ¶
func WithDefault[T, U any](onDefault func() U) MatchOption[T, U]
func WithOnData ¶
func WithOnData[T, U any](onData func(T) U) MatchOption[T, U]
func WithOnError ¶
func WithOnError[T, U any](onError func(error) U) MatchOption[T, U]
func WithOnLoading ¶
func WithOnLoading[T, U any](onLoading func() U) MatchOption[T, U]
type MatchOptions ¶
type MatchOptions[T, U any] struct { // contains filtered or unexported fields }
type Resource ¶
type Resource[T any] interface { // contains filtered or unexported methods }
func FlatMapData ¶
func ResourceError ¶
func ResourceLoading ¶
func ResourceSuccess ¶
Click to show internal directories.
Click to hide internal directories.