Documentation
¶
Index ¶
- Variables
- type Definition
- type Result
- func (r Result) Attributes() []slog.Attr
- func (r Result) Error() string
- func (r Result) IsError() bool
- func (r Result) IsSuccess() bool
- func (r Result) String() string
- func (r Result) Unwrap() error
- func (r Result) WithAttribute(attributes ...slog.Attr) Result
- func (r Result) WithError(err error) Result
- type ResultKind
Constants ¶
This section is empty.
Variables ¶
View Source
var Ok = Define( ResultKindSuccess, "OK", "OK", )
Functions ¶
This section is empty.
Types ¶
type Definition ¶
type Definition struct {
Code string
Message string
Attributes []slog.Attr
Kind ResultKind
}
func Define ¶
func Define(kind ResultKind, code string, message string, attributes ...slog.Attr) *Definition
func (*Definition) New ¶
func (r *Definition) New(payload ...any) Result
type Result ¶
type Result struct {
Definition *Definition
InnerError error
InnerPayload any
InnerAttributes []slog.Attr
}
func (Result) Attributes ¶
type ResultKind ¶ added in v0.7.0
type ResultKind int
const ( ResultKindSuccess ResultKind = 0 ResultKindError ResultKind = 1 )
func (ResultKind) String ¶ added in v0.7.0
func (i ResultKind) String() string
Click to show internal directories.
Click to hide internal directories.