package
7.1.0+incompatible
Repository: https://github.com/bianweiall/beats.git
Documentation: pkg.go.dev
# Functions
Compile takes the given map, validates the paths within it, and returns a Validator that can check real data.
Compose combines multiple SchemaValidators into a single one.
Is creates a named IsDef with the given checker.
IsAny takes a variable number of IsDef's and combines them with a logical OR.
IsArrayOf validates that the array at the given key is an array of objects all validatable via the given Validator.
IsDeepEqual checks equality using reflect.DeepEqual.
IsEqual tests that the given object is equal to the actual object.
IsEqualToTime ensures that the actual value is the given time, regardless of zone.
IsIntGt tests that a value is an int greater than.
IsStringContaining validates that the the actual value contains the specified substring.
IsStringMatching checks whether a value matches the given regexp.
IsUnique instances are used in multiple spots, flagging a value as being in error if it's seen across invocations.
KeyMissingResult is emitted when a key was expected, but was not present.
MustCompile compiles the given map, panic-ing if that map is invalid.
MustRegisterEqual is the panic-ing equivalent of RegisterEqual.
NewResults creates a new Results object.
Optional wraps an IsDef to mark the field's presence as optional.
RegisterEqual takes a function of the form fn(v someType) IsDef and registers it to check equality for that type.
No description provided by the author
SimpleResult provides a convenient and simple method for creating a *Results object for a single validation.
SingleResult returns a *Results object with a single validated value at the given path using the provided ValueResult as its sole validation.
Strict is used when you want any unspecified keys that are encountered to be considered errors.
StrictFailureResult is emitted when Strict() is used, and an unexpected field is found.
Test takes the output from a Validator invocation and runs test assertions on the result.
ValidResult is a convenience value for Valid results.
# Variables
IsDuration tests that the given value is a duration.
IsNil tests that a value is nil.
IsNonEmptyString checks that the given value is a string and has a length > 1.
IsString checks that the given value is a string.
KeyMissing checks that the given key is not present defined.
KeyMissingVR is emitted when a key was expected, but was not present.
KeyPresent checks that the given key is in the map, even if it has a nil value.
StrictFailureVR is emitted when Strict() is used, and an unexpected field is found.
ValidVR is a convenience value for Valid results.
# Structs
InvalidEqualFnError is the error type returned by RegisterEqual when there is an issue with the given function.
An IsDef defines the type of check to do.
Results the results of executing a schema.
ValueResult represents the result of checking a leaf value.
ValueResultError is used to represent an error validating an individual value.
# Type aliases
CompiledSchema represents a compiled definition for driving a Validator.
InvalidPathString is the error type returned from unparseable paths.
Map is the type used to define schema definitions for Compile and to represent an arbitrary map of values of any type.
Slice is a convenience []interface{} used to declare schema defs.
UniqScopeTracker is represents the tracking data for invoking IsUniqueTo.
Validator is the result of Compile and is run against the map you'd like to test.
A ValueValidator is used to validate a value in a Map.