View Source API Reference Dsv v0.1.1
Modules
DataLength protocol defines a function to retrieve the length of data for various data types.
Implemenations of this protocol need to implement len(data)
function.
Convert String
to one of the Date
, DateTime
, Time
or NaiveDateTime
types.
The Dsv
module provides a set of functions for validating user data of various types.
In addition to simple data types such as strings, numbers, and dates, this module offers functionality for validating complex data structures like maps, lists, and structs.
Ensure that at least one element passes the check for all validators. In the case of a string, this validator will iterate through all graphemes and check if at least one passes the validation for all validator. In the case of a list, this validator will iterate through all elements and check if at least one passes the validation for all validators.
Run validator for an element at a given position.
Specify the function that needs to be implemented by any validator used for comparing two elements from the validator input.
Dsv.Custom module provides functions to validate data using a custom validation function.
Dsv.Date module provides functions to validate a date value based on the specified rules (:min, :max, :range).
Dsv.Email module offers functions to validate an email address and optionally checks specific parts of it.
A protocol to check if a provided value is empty.
This protocol is used by the Dsv.NotEmpty
validator.
Dsv.Equal module provides functions to determine if two values are equal.
A protocol to check if two values are equal.
This protocol is used by the Dsv.Equal
validator.
Ensure a value is not on the forbidden values list. Dsv.Exclusion module provides functions to determine if a value is not present in a list.
Check if the given String
matches the regular expression.
Dsv.Format module provides a functions to determine if a string matches a regular expression.
Check if the given value is on the list of possible values. Dsv.Inclusion module provides a function to determine if a value is present in a list.
Ensure a value is not empty (default behavior) or empty if the option is set to :false
Empty lists, maps, strings, and nil values are considered empty.
Dsv.Number module provides functions to validate a number based on various options.
Dsv.Or module provides functions to validate a value against multiple validators. The validation success as soon as at least one of the validators passes.
Validate user data
Prepare validators to compare the input fields
A protocol to retrive an element at a specific position within a data structure.