Documentation ¶
Index ¶
- func Contains(actual interface{}, expected []interface{}, msgAndArgs ...interface{}) error
- func Equal(actual, expected interface{}, msgAndArgs ...interface{}) error
- func False(condition bool, msgAndArgs ...interface{}) error
- func GreaterThan(actual, expected interface{}, msgAndArgs ...interface{}) error
- func GreaterThanOrEqualTo(actual, expected interface{}, msgAndArgs ...interface{}) error
- func In(actual string, expected []string, msgAndArgs ...interface{}) error
- func LessThan(actual, expected interface{}, msgAndArgs ...interface{}) error
- func LessThanOrEqualTo(actual, expected interface{}, msgAndArgs ...interface{}) error
- func Match(actual string, regex string, msgAndArgs ...interface{}) error
- func NotEmpty(actual string, msgAndArgs ...interface{}) error
- func Panic(err error)
- func True(condition bool, msgAndArgs ...interface{}) error
- func TrueSilent(condition bool, msgAndArgs ...interface{}) error
- func Validate(v interface{}) error
- type Validatable
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
func Contains(actual interface{}, expected []interface{}, msgAndArgs ...interface{}) error
Contains checks whether the actual value is contained in the expected list. This method returns an error with the provided message if the check fails.
func Equal ¶
func Equal(actual, expected interface{}, msgAndArgs ...interface{}) error
Equal checks whether the arguments are equal (via reflect.DeepEqual). This method returns an error with the provided message if the check fails.
func False ¶
False checks whether the condition is false. This method returns an error with the provided message if the check fails.
func GreaterThan ¶
func GreaterThan(actual, expected interface{}, msgAndArgs ...interface{}) error
GreaterThan checks whether `actual` is greater than `expected`.
func GreaterThanOrEqualTo ¶
func GreaterThanOrEqualTo(actual, expected interface{}, msgAndArgs ...interface{}) error
GreaterThanOrEqualTo checks whether `actual` is greater than or equal to `expected`.
func In ¶
In checks whether the first argument is in the second argument. This method returns an error with the provided message if the check fails.
func LessThan ¶
func LessThan(actual, expected interface{}, msgAndArgs ...interface{}) error
LessThan checks whether `actual` is less than `expected`.
func LessThanOrEqualTo ¶
func LessThanOrEqualTo(actual, expected interface{}, msgAndArgs ...interface{}) error
LessThanOrEqualTo checks whether `actual` is less than or equal to `expected`.
func Match ¶
Match checks whether the first argument matches the regular expression of the second argument. The method returns an error with the provided message if the check fails.
func NotEmpty ¶
NotEmpty checks whether the first argument is empty string. The method returns an error with the provided message if the string is empty.
func True ¶
True checks whether the condition is true. This method returns an error with the provided message if the check fails.
func TrueSilent ¶
TrueSilent checks whether the condition is true. This method returns an error containing only the provided message and nothing else if the check fails.
Types ¶
type Validatable ¶
type Validatable interface {
Validate() []error
}
Validatable is implemented by anything that has fields that should be validated.