Module openvet_storage::database::functions
source · Expand description
§Database user-defined functions
This module handles registering user-defined functions into the SQLite database. This allows for enforcing type validity in the database, and ensuring there are no inconcistencies after performing a migration, and accessing type fields.
§Examples
Reading the documentation for the individual functions yields more information on this. But for example, in a database table which stores JSON-encoded values, these functions allow for type-checking this in the database upon insertion.
CREATE TABLE my_table(
id INTEGER NOT NULL PRIMARY KEY,
checksum TEXT NOT NULL UNIQUE CHECK(type_validate("openvet_common::rust::Checksum", checksum)),
files TEXT NOT NULL CHECK(type_validate("openvet_common::tree::Node", files))
) STRICT;
Functions§
- Register regular expression functions.
- Register all user-defined functions for a SQLite database [
Connection]. - Register a validation function for a type that uses the
FromStrto check the type. - Register a validation function that checks the type for correct JSON-encoding.
- Register all built-in validation functions.
- Defines functions for working with semantic versioning
Versionin the database. - Type validation functions
Type Aliases§
- Signature for a validation function, used to validate JSON.