View Source API Reference Dsv v0.2.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.

Dsv

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.

Dsv.All validator provides functions to validate that all elements in the given List or String meets all validation criteria.

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.

Dsv.Length module provides a functions to check if the length of an input value meets specified criteria. Value can be of the type: String, List, Map, Tuple, Integer, Float. To use values of different type this type need to implement DataLength protocol.

Dsv.None validator provides a functions to check that there is no element on the provided List or String that meets any of the provided criteria.

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.

Ensure that input data are of the typed defined in the validator.

Validate user data

Prepare validators to compare the input fields

Protocol used to iterate over elements of the iterable. This protocol is used in Dsv.Any, Dsv.All and Dsv.None validators.

A protocol to retrive an element at a specific position within a data structure.