refactored result wrapper func names
This commit is contained in:
parent
faf75185ae
commit
4612cb74b2
@ -13,12 +13,12 @@ func ResultOf[T any](value T, err error) Result[T] {
|
||||
return Result[T]{value: &value, err: nil}
|
||||
}
|
||||
|
||||
func WrapMapFunc[I, O any](f func(I) (O, error)) func(I) Result[O] {
|
||||
func WrapResultOutputFunc[I, O any](f func(I) (O, error)) func(I) Result[O] {
|
||||
return func(i I) Result[O] { return ResultOf(f(i)) }
|
||||
}
|
||||
|
||||
func ResultFunc[I, O any](f func(I) (O, error)) func(Result[I]) Result[O] {
|
||||
resFunc := WrapMapFunc(f)
|
||||
func WrapResultFunc[I, O any](f func(I) (O, error)) func(Result[I]) Result[O] {
|
||||
resFunc := WrapResultOutputFunc(f)
|
||||
nilValue := *new(O)
|
||||
return func(r Result[I]) Result[O] {
|
||||
v, err := r.Get()
|
||||
|
Loading…
Reference in New Issue
Block a user