Documentation ¶
Overview ¶
Package assert provides value assertions.
Index ¶
- Variables
- func And(assertions ...Assertion) func(*query.Query) Assertion
- func Contains(assertion Assertion) func(*query.Query) Assertion
- func NotContains(assertion Assertion) func(*query.Query) Assertion
- func Or(assertions ...Assertion) func(*query.Query) Assertion
- func Regexp(expr string) func(*query.Query) Assertion
- type Assertion
- type AssertionFunc
- type Error
Constants ¶
This section is empty.
Variables ¶
View Source
var AppendError = multierror.Append
AppendError is a helper function that will append more errors onto an Error in order to create a larger multi-error.
Functions ¶
func And ¶ added in v0.5.1
And returns a new assertion to ensure that value passes all assertions. If the assertions are empty, it returns an error.
func NotContains ¶
NotContains returns an assertion to ensure a value doesn't contain the value.
Types ¶
type Assertion ¶
type Assertion interface {
Assert(v interface{}) error
}
Assertion implements value assertion.
type AssertionFunc ¶
type AssertionFunc func(v interface{}) error
AssertionFunc is an adaptor to allow the use of ordinary functions as assertions.
func (AssertionFunc) Assert ¶
func (f AssertionFunc) Assert(v interface{}) error
Assert asserts the v.
Click to show internal directories.
Click to hide internal directories.