resource

package
v0.1.101 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Match

func Match[T, U any](resource Resource[T], onLoading func() U, onError func(error) U, onData func(T) U) U

func MatchOnData added in v0.1.95

func MatchOnData[T, U any](resource Resource[T], onData func(T) U, defaultValue U) U

func MatchOnDataLazy added in v0.1.95

func MatchOnDataLazy[T, U any](resource Resource[T], onData func(T) U, defaultValue func() U) U

func MatchOnError added in v0.1.95

func MatchOnError[T, U any](resource Resource[T], onError func(error) U, defaultValue U) U

func MatchOnErrorLazy added in v0.1.95

func MatchOnErrorLazy[T, U any](resource Resource[T], onError func(error) U, defaultValue func() U) U

func MatchOnLoading added in v0.1.95

func MatchOnLoading[T, U any](resource Resource[T], onLoading func() U, defaultValue U) U

func MatchOnLoadingLazy added in v0.1.95

func MatchOnLoadingLazy[T, U any](resource Resource[T], onLoading func() U, defaultValue func() U) U

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 FlatMapData[T, U any](resource Resource[T], fn func(T) Resource[U]) Resource[U]

func MapData

func MapData[T, U any](resource Resource[T], fn func(T) U) Resource[U]

func MapError

func MapError[T any](resource Resource[T], fn func(error) error) Resource[T]

func ResourceError

func ResourceError[T any](err error) Resource[T]

func ResourceLoading

func ResourceLoading[T any]() Resource[T]

func ResourceSuccess

func ResourceSuccess[T any](data T) Resource[T]

Jump to

Keyboard shortcuts

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