Documentation
¶
Overview ¶
Package result implements the unified result type for operations
Index ¶
- type Result
- func NewErrorResult[S any](err error) Result[S]
- func NewResult[S any](val *S, err error) Result[S]
- func NewValueResult[S any](val *S) Result[S]
- func With[S any](target *S, ss []func(*S)) Result[S]
- func WithE[S any](target *S, ss []func(*S) error) Result[S]
- func WithMixed[S any](target *S, ss []any) Result[S]
- func WithZero[S any](settings []func(*S)) Result[S]
- func WithZeroE[S any](settings []func(*S) error) Result[S]
- func WithZeroMixed[S any](settings []any) Result[S]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result[S any] interface { // Value returns the configured struct pointer Value() *S // Err returns any error occurred during configuration Err() error // Unwrap returns both value and error for direct handling Unwrap() (*S, error) // MustUnwrap panics if error exists MustUnwrap() *S }
Result defines the unified return type for configuration operations
func NewErrorResult ¶
func NewValueResult ¶
func WithZero ¶
WithZero creates a zero-value instance and applies settings. Parameters:
- settings: Configuration functions to apply
Returns:
- *S: New configured instance
func WithZeroMixed ¶
Click to show internal directories.
Click to hide internal directories.