must

package
v0.0.0-...-e225f37 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNil = errors.New("is nil")
)

Functions

func BeTrue

func BeTrue(ok bool, args ...any)

func Func

func Func(errFunc func() error, args ...interface{})

func Int

func Int(n int, err error, args ...interface{}) int

func NonNil

func NonNil[T any](t *T, args ...any) *T

func Ok

func Ok(err error, args ...interface{})

1. Ok() does nothing if err == nil 2. Otherwise if no args are given Ok() will panic(err) 3. Otherwise the first args can be error's. if err Is one of them Ok() does nothing 4. Otherwise the next arg can be a format string for fmt.Sprintf(). If so it will be passed with the remaining args to Sprintf() and Ok() will panic with that message 5. Otherwise Ok() will panic with fmt.Sprint(args...)

func Ok1

func Ok1[R any](retval R, err error, args ...interface{}) R

func Ok2

func Ok2[R1 any, R2 any](retval1 R1, retval2 R2, err error, args ...interface{}) (R1, R2)

func Ok3

func Ok3[R1, R2, R3 any](retval1 R1, retval2 R2, retval3 R3, err error, args ...interface{}) (R1, R2, R3)

func Ok4

func Ok4[R1, R2, R3, R4 any](retval1 R1, retval2 R2, retval3 R3, retval4 R4, err error, args ...interface{}) (R1, R2, R3, R4)

func Ok5

func Ok5[R1, R2, R3, R4, R5 any](retval1 R1, retval2 R2, retval3 R3, retval4 R4, retval5 R5, err error, args ...interface{}) (R1, R2, R3, R4, R5)

func OrDo

func OrDo(err error, do func(any), args []interface{})

func OrPanic

func OrPanic(err error, args []interface{})

1. OrPanic() does nothing if err == nil 2. Otherwise if no args are given OrPanic() will panic(err) 3. Otherwise the first arg can be a format string for fmt.Sprintf(). If so it will be passed with the remaining args to Sprintf() and OrPanic() will panic with that message 4. Otherwise OrPanic() will panic with fmt.Sprint(args...)

func Rel

func Rel(basePath, targetPath string) string

func Str

func Str(s string, err error, args ...interface{}) string

func Val

func Val(v interface{}, err error) beOkT

Types

This section is empty.

Jump to

Keyboard shortcuts

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