package resultext
import "github.com/go-playground/pkg/v5/values/result"
Index ¶
Types ¶
type Result ¶
type Result[T, E any] struct { // contains filtered or unexported fields }
Result represents the result of an operation that is successful or not.
func Err ¶
Err returns a Result that contains the given error.
func Ok ¶
Ok returns a Result that contains the given values.
func (Result[T, E]) Err ¶
func (r Result[T, E]) Err() E
Err returns the error of the result. To be used after calling IsOK()
func (Result[T, E]) IsErr ¶
IsErr returns true if the result is not successful and has an error.
func (Result[T, E]) IsOk ¶
IsOk returns true if the result is successful with no error.
func (Result[T, E]) Unwrap ¶
func (r Result[T, E]) Unwrap() T
Unwrap returns the values of the result. It panics if there is no result due to not checking for errors.
Source Files ¶
Tools for package owners.