ockam_node::storage

Module database

Source
Expand description

Database support

Modules§

application_migration_set
This module defines the migrations to apply to the application database
node_migration_set
This module defines the migrations to apply to the application database
sqlite
SQLite rust migrations

Macros§

retry
This macro wraps a function with retry calls to keep calling the function until the error “database is locked” is not raised anymore.

Structs§

AutoRetry
Wrapper for an auto-retried struct
Boolean
This type is used to map boolean fields for the types deriving FrowRow. Postgres provides a proper boolean type but SQLite maps them as integers.
DatabaseUser
User of the Postgres database
Migrator
Migrator is responsible for running Sql and Rust migrations side by side in the correct order, checking for conflicts, duplicates; making sure each migration runs only once
Nullable
This type is used to map Option fields for the types deriving FromRow
SqlxDatabase
The SqlxDatabase struct is used to create a database:

Enums§

DatabaseConfiguration
Configuration for the database. We either use Sqlite or Postgres
DatabaseType
Type of database

Constants§

OCKAM_DATABASE_CONNECTION_URL
Database connection URL
OCKAM_SQLITE_IN_MEMORY
Use an in-memory SQLite database

Traits§

FromSqlxError
This trait provides some syntax for transforming sqlx errors into ockam errors
MigrationSet
This trait runs migrations on a given database
RustMigration
Individual rust migration
ToVoid
This trait provides some syntax to shorten queries execution returning ()

Functions§

create_temp_db_file
Create a temporary database file that won’t be cleaned-up automatically
skip_if_postgres
This function can be used to avoid running a test if the postgres database is used.
with_application_dbs
This function can be used to run some test code with the 3 different databases implementations of the application database
with_dbs
This function can be used to run some test code with the 3 different databases implementations
with_postgres
This function can be used to run some test code with a postgres database
with_sqlite_dbs
This function can be used to run some test code with the 2 SQLite databases implementations