mustutils

package
v0.231.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Must

func Must[T any](v T, err error) T

Used to apply the Must pattern to any function returning a value and an error:

Usage: x := Must(functionReturningOneValueAndAnError())
If there is no error the return value is returned and stored into 'x'.
If there is an error it will be logged using `logging.LogGoErrorFatal(err)` which aborts the execution.

func Must2

func Must2[T1 any, T2 any](v1 T1, v2 T2, err error) (T1, T2)

Same as `Must` but supporting 2 return values.

func Must3

func Must3[T1 any, T2 any, T3 any](v1 T1, v2 T2, v3 T3, err error) (T1, T2, T3)

Same as `Must` but supporting 3 return values.

func Must4

func Must4[T1 any, T2 any, T3 any, T4 any](v1 T1, v2 T2, v3 T3, v4 T4, err error) (T1, T2, T3, T4)

Same as `Must` but supporting 4 return values.

Types

This section is empty.

Jump to

Keyboard shortcuts

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