Hide all Result fields
This commit is contained in:
parent
570d7e32fc
commit
bb1e77e8cd
@ -11,16 +11,16 @@ import (
|
|||||||
|
|
||||||
type Result[In, Out any] struct {
|
type Result[In, Out any] struct {
|
||||||
consumed, failed bool
|
consumed, failed bool
|
||||||
Value Out
|
value Out
|
||||||
next State[In]
|
next State[In]
|
||||||
Message Message
|
message Message
|
||||||
}
|
}
|
||||||
|
|
||||||
func Fail[In, Out any](consumed bool, msg Message) Result[In, Out] {
|
func Fail[In, Out any](consumed bool, msg Message) Result[In, Out] {
|
||||||
return Result[In, Out]{
|
return Result[In, Out]{
|
||||||
consumed: consumed,
|
consumed: consumed,
|
||||||
failed: true,
|
failed: true,
|
||||||
Message: msg,
|
message: msg,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ func (r Result[In, Out]) Failed() (ok, consumed bool, msg Message) {
|
|||||||
ok = r.failed
|
ok = r.failed
|
||||||
if ok {
|
if ok {
|
||||||
consumed = r.consumed
|
consumed = r.consumed
|
||||||
msg = r.Message
|
msg = r.message
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -36,10 +36,10 @@ func (r Result[In, Out]) Failed() (ok, consumed bool, msg Message) {
|
|||||||
func Succeed[In, Out any](consumed bool, value Out, next State[In], msg Message) Result[In, Out] {
|
func Succeed[In, Out any](consumed bool, value Out, next State[In], msg Message) Result[In, Out] {
|
||||||
return Result[In, Out]{
|
return Result[In, Out]{
|
||||||
failed: false,
|
failed: false,
|
||||||
Value: value,
|
value: value,
|
||||||
consumed: consumed,
|
consumed: consumed,
|
||||||
next: next,
|
next: next,
|
||||||
Message: msg,
|
message: msg,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,9 +47,9 @@ func (r Result[In, Out]) Succeeded() (ok, consumed bool, value Out, next State[I
|
|||||||
ok = !r.failed
|
ok = !r.failed
|
||||||
if ok {
|
if ok {
|
||||||
consumed = r.consumed
|
consumed = r.consumed
|
||||||
value = r.Value
|
value = r.value
|
||||||
next = r.next
|
next = r.next
|
||||||
msg = r.Message
|
msg = r.message
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user