orerr

package
v0.0.0-...-8b02fee Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 0 Imported by: 1

Documentation

Overview

Package orerr provides a type OrErr for working with (value, error) pairs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OrErr

type OrErr[V any] struct {
	// contains filtered or unexported fields
}

An OrErr[V] bundles a value of type V with a possibly-nil error. This allows the user to pass around a single value instead of dealing with tuples.

Values can be extracted with Get; callers should check the error as with any other method that returns an error.

func New

func New[V any](value V, err error) OrErr[V]

New bundles a value and possible error in an OrErr.

func (OrErr[V]) Err

func (t OrErr[V]) Err() error

Err returns the error from the OrErr.

func (OrErr[V]) Get

func (t OrErr[V]) Get() (V, error)

Get gets the components of the T.

Jump to

Keyboard shortcuts

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