assert

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAssertionFailed         = falta.Newf("assert: [%s] assertion failed")
	ErrValueIsNil              = falta.Newf("<%T> is nil")
	ErrContainerIsEmpty        = falta.Newf("<%T> container is empty")
	ErrValueIsNegative         = falta.Newf("%v < 0")
	ErrValueIsNotPositive      = falta.Newf("%v <= 0")
	ErrValueIsZero             = falta.Newf("value == 0")
	ErrErrorIsNotNil           = falta.Newf("err is not nil: %v")
	ErrSlicesAreDifferentSizes = falta.Newf("slices are different sizes: %v != %v")
	ErrFuncReturnedError       = falta.Newf("<%T> no error expected: %v")
	ErrKeyNotInMap             = falta.Newf(`keys not in map: %v not in <%T>`)
	ErrPanic                   = falta.Newf("panic: %s")
)

Functions

func CatchPanic added in v0.4.0

func CatchPanic(err *error)

func FatalOnError added in v0.5.0

func FatalOnError(err *error, l ...*logrus.Entry)

func Handle

func Handle(err *error, l ...*logrus.Entry)

func HasKeys

func HasKeys[K comparable, V any, M ~map[K]V](m M, ks ...K)

func NoError

func NoError(err error)

func NotEmpty

func NotEmpty[T any](val []T)

func NotNegative

func NotNegative[T constraints.Integer | constraints.Float](val T)

func NotNil

func NotNil[T any](val *T)

func NotZero

func NotZero[T constraints.Integer | constraints.Float](val T)

func Positive

func Positive[T constraints.Integer | constraints.Float](val T)

func SameSize

func SameSize[T, U any](a []T, b []U)

func Success added in v0.6.0

func Success[T any](val T, err error) T

Types

type Op added in v0.8.0

type Op struct {
	// contains filtered or unexported fields
}

func NewOp added in v0.8.0

func NewOp(l *logrus.Entry) Op

func (Op) NoError added in v0.8.0

func (o Op) NoError(err error)

Jump to

Keyboard shortcuts

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