refactor
This commit is contained in:
parent
3dfcee4ee4
commit
faf75185ae
@ -64,7 +64,7 @@ func (r Result[T]) Err() error {
|
||||
}
|
||||
|
||||
func FilterSuccess[T any](source <-chan Result[T]) <-chan T {
|
||||
succeeded := Filter(source, func(r Result[T]) bool { return r.Success() })
|
||||
succeeded := Filter(source, Result[T].Success)
|
||||
|
||||
return MapSuccessive(succeeded, func(r Result[T]) T {
|
||||
v, _ := r.Get()
|
||||
@ -73,7 +73,7 @@ func FilterSuccess[T any](source <-chan Result[T]) <-chan T {
|
||||
}
|
||||
|
||||
func FilterFail[T any](source <-chan Result[T]) <-chan T {
|
||||
failed := Filter(source, func(r Result[T]) bool { return r.Fail() })
|
||||
failed := Filter(source, Result[T].Fail)
|
||||
|
||||
return MapSuccessive(failed, func(r Result[T]) T {
|
||||
v, _ := r.Get()
|
||||
@ -94,7 +94,7 @@ func FilterResults[T any](source <-chan Result[T]) (succeeded <-chan T, failed <
|
||||
fail <- r.Err()
|
||||
continue
|
||||
}
|
||||
succ <- r.GetSafe()
|
||||
succ <- r.GetUnsafe()
|
||||
}
|
||||
}()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user