Documentation ¶
Overview ¶
Package require provides functions that to check conditions and panic when they are not met.
Index ¶
- func AreEqual[T comparable](x, y T)
- func AreNotEqual[T comparable](x, y T)
- func DirExists(path string)
- func FileExists(path string)
- func IsFalse(condition bool)
- func IsGreaterThan[T constraints.Ordered](target, value T)
- func IsGreaterThanOrEquals[T constraints.Ordered](target, value T)
- func IsInRange[T constraints.Ordered](low, high, value T)
- func IsIndexInRange[T any](i int, slice []T)
- func IsLessThan[T constraints.Ordered](target, value T)
- func IsLessThanOrEquals[T constraints.Ordered](target, value T)
- func IsNotZero[T comparable](x T)
- func IsOfType[T any](value T, t reflect.Type)
- func IsOfTypeBool(value interface{})
- func IsOfTypeFloat32(value interface{})
- func IsOfTypeFloat64(value interface{})
- func IsOfTypeInt(value interface{})
- func IsOfTypeString(value interface{})
- func IsTrue(condition bool)
- func IsZero[T comparable](x T)
- func StringIsEmpty(s string)
- func StringIsNotEmpty(s string)
- func StringIsNotWhitespaceOnly(s string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreEqual ¶
func AreEqual[T comparable](x, y T)
AreEqual enforces that two values are equal to each other.
func AreNotEqual ¶
func AreNotEqual[T comparable](x, y T)
AreNotEqual enforces that two value are NOT equal to each other.
func FileExists ¶
func FileExists(path string)
FileExists enforces that the file path already exists.
func IsGreaterThan ¶
func IsGreaterThan[T constraints.Ordered](target, value T)
IsGreaterThan enforces that value > target.
func IsGreaterThanOrEquals ¶
func IsGreaterThanOrEquals[T constraints.Ordered](target, value T)
IsGreaterThanOrEquals enforces that value >= target.
func IsInRange ¶
func IsInRange[T constraints.Ordered](low, high, value T)
IsInRange enforces that value is between low and high, exclusive of high.
For example, 5 would meet the requirement with a low of 2 and a high of 10, but 10 would not.
func IsIndexInRange ¶
IsIndexInRange enforces that index i is valid for the slice.
func IsLessThan ¶
func IsLessThan[T constraints.Ordered](target, value T)
IsLessThan enforces that value < target.
func IsLessThanOrEquals ¶
func IsLessThanOrEquals[T constraints.Ordered](target, value T)
IsLessThanOrEquals enforces that value <= target.
func IsNotZero ¶
func IsNotZero[T comparable](x T)
IsNotZero enforces that a value is NOT set to its zero value.
func IsOfTypeBool ¶
func IsOfTypeBool(value interface{})
IsOfTYpe enforces that value is of type bool.
func IsOfTypeFloat32 ¶
func IsOfTypeFloat32(value interface{})
IsOfTYpe enforces that value is of type float32.
func IsOfTypeFloat64 ¶
func IsOfTypeFloat64(value interface{})
IsOfTYpe enforces that value is of type float64.
func IsOfTypeString ¶
func IsOfTypeString(value interface{})
IsOfTYpe enforces that value is of type string.
func StringIsEmpty ¶
func StringIsEmpty(s string)
StringIsEmpty enforces that a string has len of zero.
func StringIsNotEmpty ¶
func StringIsNotEmpty(s string)
StringIsNotEmpty enforces that a string has a len greater than zero.
func StringIsNotWhitespaceOnly ¶
func StringIsNotWhitespaceOnly(s string)
StringIsNotWhitespaceOnly enforces that a string is not empty or composed of only whitespace.
Types ¶
This section is empty.