Renamed Result.Succeeded to Status and removed Failed
This commit is contained in:
80
bind.go
80
bind.go
@ -18,20 +18,20 @@ func Bind[In, Out, T any](
|
||||
return Result[In, Out]{}, err
|
||||
}
|
||||
anyConsumed = anyConsumed || r.Consumed()
|
||||
if r.Failed() {
|
||||
success, val, next := r.Status()
|
||||
if !success {
|
||||
return Fail[In, Out](anyConsumed, r.Message()), nil
|
||||
}
|
||||
_, val, next := r.Succeeded()
|
||||
|
||||
r2, err := f(val)(next)
|
||||
if err != nil {
|
||||
return Result[In, Out]{}, err
|
||||
}
|
||||
anyConsumed = anyConsumed || r2.Consumed()
|
||||
if r2.Failed() {
|
||||
success, val2, next := r2.Status()
|
||||
if !success {
|
||||
return Fail[In, Out](anyConsumed, r2.Message()), nil
|
||||
}
|
||||
_, val2, next := r2.Succeeded()
|
||||
|
||||
return Succeed(anyConsumed, val2, next, MessageOK(s.Pos())), nil
|
||||
}
|
||||
@ -52,30 +52,30 @@ func Bind2[In, Out, T, T2 any](
|
||||
return Result[In, Out]{}, err
|
||||
}
|
||||
anyConsumed = anyConsumed || r.Consumed()
|
||||
if r.Failed() {
|
||||
success, val, next := r.Status()
|
||||
if !success {
|
||||
return Fail[In, Out](anyConsumed, r.Message()), nil
|
||||
}
|
||||
_, val, next := r.Succeeded()
|
||||
|
||||
r2, err := f(val)(next)
|
||||
if err != nil {
|
||||
return Result[In, Out]{}, err
|
||||
}
|
||||
anyConsumed = anyConsumed || r2.Consumed()
|
||||
if r2.Failed() {
|
||||
success, val2, next := r2.Status()
|
||||
if !success {
|
||||
return Fail[In, Out](anyConsumed, r2.Message()), nil
|
||||
}
|
||||
_, val2, next := r2.Succeeded()
|
||||
|
||||
r3, err := f2(val2)(next)
|
||||
if err != nil {
|
||||
return Result[In, Out]{}, err
|
||||
}
|
||||
anyConsumed = anyConsumed || r3.Consumed()
|
||||
if r3.Failed() {
|
||||
success, val3, next := r3.Status()
|
||||
if !success {
|
||||
return Fail[In, Out](anyConsumed, r3.Message()), nil
|
||||
}
|
||||
_, val3, next := r3.Succeeded()
|
||||
|
||||
return Succeed(anyConsumed, val3, next, MessageOK(s.Pos())), nil
|
||||
}
|
||||
@ -97,40 +97,40 @@ func Bind3[In, Out, T, T2, T3 any](
|
||||
return Result[In, Out]{}, err
|
||||
}
|
||||
anyConsumed = anyConsumed || r.Consumed()
|
||||
if r.Failed() {
|
||||
success, val, next := r.Status()
|
||||
if !success {
|
||||
return Fail[In, Out](anyConsumed, r.Message()), nil
|
||||
}
|
||||
_, val, next := r.Succeeded()
|
||||
|
||||
r2, err := f(val)(next)
|
||||
if err != nil {
|
||||
return Result[In, Out]{}, err
|
||||
}
|
||||
anyConsumed = anyConsumed || r2.Consumed()
|
||||
if r2.Failed() {
|
||||
success, val2, next := r2.Status()
|
||||
if !success {
|
||||
return Fail[In, Out](anyConsumed, r2.Message()), nil
|
||||
}
|
||||
_, val2, next := r2.Succeeded()
|
||||
|
||||
r3, err := f2(val2)(next)
|
||||
if err != nil {
|
||||
return Result[In, Out]{}, err
|
||||
}
|
||||
anyConsumed = anyConsumed || r3.Consumed()
|
||||
if r3.Failed() {
|
||||
success, val3, next := r3.Status()
|
||||
if !success {
|
||||
return Fail[In, Out](anyConsumed, r3.Message()), nil
|
||||
}
|
||||
_, val3, next := r3.Succeeded()
|
||||
|
||||
r4, err := f3(val3)(next)
|
||||
if err != nil {
|
||||
return Result[In, Out]{}, err
|
||||
}
|
||||
anyConsumed = anyConsumed || r4.Consumed()
|
||||
if r4.Failed() {
|
||||
success, val4, next := r4.Status()
|
||||
if !success {
|
||||
return Fail[In, Out](anyConsumed, r4.Message()), nil
|
||||
}
|
||||
_, val4, next := r4.Succeeded()
|
||||
|
||||
return Succeed(anyConsumed, val4, next, MessageOK(s.Pos())), nil
|
||||
}
|
||||
@ -153,50 +153,50 @@ func Bind4[In, Out, T, T2, T3, T4 any](
|
||||
return Result[In, Out]{}, err
|
||||
}
|
||||
anyConsumed = anyConsumed || r.Consumed()
|
||||
if r.Failed() {
|
||||
success, val, next := r.Status()
|
||||
if !success {
|
||||
return Fail[In, Out](anyConsumed, r.Message()), nil
|
||||
}
|
||||
_, val, next := r.Succeeded()
|
||||
|
||||
r2, err := f(val)(next)
|
||||
if err != nil {
|
||||
return Result[In, Out]{}, err
|
||||
}
|
||||
anyConsumed = anyConsumed || r2.Consumed()
|
||||
if r2.Failed() {
|
||||
success, val2, next := r2.Status()
|
||||
if !success {
|
||||
return Fail[In, Out](anyConsumed, r2.Message()), nil
|
||||
}
|
||||
_, val2, next := r2.Succeeded()
|
||||
|
||||
r3, err := f2(val2)(next)
|
||||
if err != nil {
|
||||
return Result[In, Out]{}, err
|
||||
}
|
||||
anyConsumed = anyConsumed || r3.Consumed()
|
||||
if r3.Failed() {
|
||||
success, val3, next := r3.Status()
|
||||
if !success {
|
||||
return Fail[In, Out](anyConsumed, r3.Message()), nil
|
||||
}
|
||||
_, val3, next := r3.Succeeded()
|
||||
|
||||
r4, err := f3(val3)(next)
|
||||
if err != nil {
|
||||
return Result[In, Out]{}, err
|
||||
}
|
||||
anyConsumed = anyConsumed || r4.Consumed()
|
||||
if r4.Failed() {
|
||||
success, val4, next := r4.Status()
|
||||
if !success {
|
||||
return Fail[In, Out](anyConsumed, r4.Message()), nil
|
||||
}
|
||||
_, val4, next := r4.Succeeded()
|
||||
|
||||
r5, err := f4(val4)(next)
|
||||
if err != nil {
|
||||
return Result[In, Out]{}, err
|
||||
}
|
||||
anyConsumed = anyConsumed || r5.Consumed()
|
||||
if r5.Failed() {
|
||||
success, val5, next := r5.Status()
|
||||
if !success {
|
||||
return Fail[In, Out](anyConsumed, r5.Message()), nil
|
||||
}
|
||||
_, val5, next := r5.Succeeded()
|
||||
|
||||
return Succeed(anyConsumed, val5, next, MessageOK(s.Pos())), nil
|
||||
}
|
||||
@ -220,60 +220,60 @@ func Bind5[In, Out, T, T2, T3, T4, T5 any](
|
||||
return Result[In, Out]{}, err
|
||||
}
|
||||
anyConsumed = anyConsumed || r.Consumed()
|
||||
if r.Failed() {
|
||||
success, val, next := r.Status()
|
||||
if !success {
|
||||
return Fail[In, Out](anyConsumed, r.Message()), nil
|
||||
}
|
||||
_, val, next := r.Succeeded()
|
||||
|
||||
r2, err := f(val)(next)
|
||||
if err != nil {
|
||||
return Result[In, Out]{}, err
|
||||
}
|
||||
anyConsumed = anyConsumed || r2.Consumed()
|
||||
if r2.Failed() {
|
||||
success, val2, next := r2.Status()
|
||||
if !success {
|
||||
return Fail[In, Out](anyConsumed, r2.Message()), nil
|
||||
}
|
||||
_, val2, next := r2.Succeeded()
|
||||
|
||||
r3, err := f2(val2)(next)
|
||||
if err != nil {
|
||||
return Result[In, Out]{}, err
|
||||
}
|
||||
anyConsumed = anyConsumed || r3.Consumed()
|
||||
if r3.Failed() {
|
||||
success, val3, next := r3.Status()
|
||||
if !success {
|
||||
return Fail[In, Out](anyConsumed, r3.Message()), nil
|
||||
}
|
||||
_, val3, next := r3.Succeeded()
|
||||
|
||||
r4, err := f3(val3)(next)
|
||||
if err != nil {
|
||||
return Result[In, Out]{}, err
|
||||
}
|
||||
anyConsumed = anyConsumed || r4.Consumed()
|
||||
if r4.Failed() {
|
||||
success, val4, next := r4.Status()
|
||||
if !success {
|
||||
return Fail[In, Out](anyConsumed, r4.Message()), nil
|
||||
}
|
||||
_, val4, next := r4.Succeeded()
|
||||
|
||||
r5, err := f4(val4)(next)
|
||||
if err != nil {
|
||||
return Result[In, Out]{}, err
|
||||
}
|
||||
anyConsumed = anyConsumed || r5.Consumed()
|
||||
if r5.Failed() {
|
||||
success, val5, next := r5.Status()
|
||||
if !success {
|
||||
return Fail[In, Out](anyConsumed, r5.Message()), nil
|
||||
}
|
||||
_, val5, next := r5.Succeeded()
|
||||
|
||||
r6, err := f5(val5)(next)
|
||||
if err != nil {
|
||||
return Result[In, Out]{}, err
|
||||
}
|
||||
anyConsumed = anyConsumed || r6.Consumed()
|
||||
if r6.Failed() {
|
||||
success, val6, next := r6.Status()
|
||||
if !success {
|
||||
return Fail[In, Out](anyConsumed, r6.Message()), nil
|
||||
}
|
||||
_, val6, next := r6.Succeeded()
|
||||
|
||||
return Succeed(anyConsumed, val6, next, MessageOK(s.Pos())), nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user