Function openvet_storage::database::functions::validate_functions

source ยท
pub fn validate_functions(db: &Connection) -> Result<()>
Expand description

Type validation functions

This registers the type_validate function, which can then be used from within SQLite to validate data types.

SQLite only has a limited set of data types it supports for columns. However, we want to use these to store specific kinds of data, such as JSON-encoded values of a specific shape, or identifiers which have specific restrictions. To make this possible, the type_validate() functions allows us to place additional restrictions on what values columns can take.

This function uses a registry of type validations, which is populated at runtime using the appropriate helper methods: