Documentation ¶
Index ¶
- Variables
- func Assert(cond bool, msg any, args ...interface{}) error
- func AssertFunc(fail func(err error) error, cond bool, msg any, args ...interface{}) error
- func Contains[T comparable](v T, a []T, msg any, args ...interface{}) error
- func ContainsFunc[T any](a []T, f func(T) (in bool), msg any, args ...interface{}) error
- func Equal[T comparable](a, b T, msg any, args ...interface{}) error
- func Err(err error) error
- func ErrNil(err error) error
- func Fail(msg any, args ...interface{}) error
- func FailFunc(failFn func(err error) error, msg any, args ...interface{}) error
- func False(cond bool, msg any, args ...interface{}) error
- func Falsy(v any, msg any, args ...interface{}) error
- func Gt[T any](a []T, min int, msg any, args ...interface{}) error
- func Gte[T any](a []T, min int, msg any, args ...interface{}) error
- func Lt[T any](a []T, max int, msg any, args ...interface{}) error
- func Lte[T any](a []T, max int, msg any, args ...interface{}) error
- func True(cond bool, msg any, args ...interface{}) error
- func Truthy(v any, msg any, args ...interface{}) error
- type AssertError
Constants ¶
This section is empty.
Variables ¶
var ( Panic func(error) = func(err error) { panic(err) } LogOnError func(error) AssertionFailedError AssertError = "assertion failed" )
Functions ¶
func Assert ¶
Assert asserts that the condition is true if the condition is false, it panics with the message
func AssertFunc ¶
AssertFunc asserts that the condition is true if the condition is false, it panics with the message
func Contains ¶
func Contains[T comparable](v T, a []T, msg any, args ...interface{}) error
Contains asserts that the value is in the slice if the value is not in the slice, it panics with the message
func ContainsFunc ¶
ContainsFunc asserts that the value is in the slice if the value is not in the slice, it panics with the message
func Equal ¶
func Equal[T comparable](a, b T, msg any, args ...interface{}) error
Equal asserts that the two values are equal if the two values are not equal, it panics with the message
func ErrNil ¶
ErrNil asserts that the error is not nil if the error is nil, it panics with the message
func Fail ¶
Fail is called when an assertion fails It is used to either return an error if PanicEnabled is false or panic if PanicEnabled is true
func FailFunc ¶
FailFunc is a function that is called when an assertion fails it is used to customize the behavior of the assertion
func False ¶
False asserts that the condition is false if the condition is true, it panics with the message
func Falsy ¶
Falsy asserts that the value is falsy A value is falsy if it is an invalid value or the zero value
func Gt ¶
Gt asserts that the length of the slice is greater than the min if the length is less than or equal to the min, it panics with the message
func Gte ¶
Gte asserts that the length of the slice is greater than or equal to the min if the length is less than the min, it panics with the message
func Lt ¶
Lt asserts that the length of the slice is less than the max if the length is greater than or equal to the max, it panics with the message
func Lte ¶
Lte asserts that the length of the slice is less than or equal to the max if the length is greater than the max, it panics with the message