Expand description
Crate for accessing database(s) of a HOPR node. Functionality defined here is meant to be used mostly by other higher-level crates.
Re-exports§
pub use hopr_db_api as api;
Modules§
Structs§
- Database
Transaction - Defines a database transaction, whether it is an open transaction and the type of backend to use
- Open
Transaction - Represents an already opened transaction. This is a thin wrapper over DatabaseTransaction. The wrapping behavior is needed to allow transaction agnostic functionalities of the DB traits.
Enums§
- Database
Connection - Handle a database connection depending on the backend enabled by the feature
flags. This creates a database pool. This will be
Clone
unless the feature flagmock
is enabled. - Target
Db - When Sqlite is used as a backend, model needs to be split into 4 different databases to avoid locking the database. On Postgres backend, these should actually point to the same database.
Constants§
- SINGULAR_
TABLE_ FIXED_ ID - Primary key used in tables that contain only a single row.
Traits§
- Hopr
DbAll Operations - Convenience trait that contain all HOPR DB operations crates.
- Hopr
DbGeneral Model Operations
Type Aliases§
- DbTimestamp
- Shorthand for the
chrono
based timestamp type used in the database. - OptTx
- Shorthand for optional transaction.
Useful for transaction nesting (see
HoprDbGeneralModelOperations::nest_transaction
).