result

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package result implements the unified result type for operations

Index

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 NewErrorResult[S any](err error) Result[S]

func NewResult

func NewResult[S any](val *S, err error) Result[S]

func NewValueResult

func NewValueResult[S any](val *S) Result[S]

func With

func With[S any](target *S, ss []func(*S)) Result[S]

func WithE

func WithE[S any](target *S, ss []func(*S) error) Result[S]

func WithMixed

func WithMixed[S any](target *S, ss []any) Result[S]

func WithZero

func WithZero[S any](settings []func(*S)) Result[S]

WithZero creates a zero-value instance and applies settings. Parameters:

  • settings: Configuration functions to apply

Returns:

  • *S: New configured instance

func WithZeroE

func WithZeroE[S any](settings []func(*S) error) Result[S]

func WithZeroMixed

func WithZeroMixed[S any](settings []any) Result[S]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL