Skip to main content

varpulis_db/
lib.rs

1#![allow(missing_docs)]
2//! PostgreSQL database layer for Varpulis Cloud.
3//!
4//! Provides typed models, a repository of CRUD operations, and connection pool
5//! management for the Varpulis multi-tenant platform.
6
7pub mod models;
8pub mod pool;
9pub mod repo;
10
11pub use models::*;
12pub use sqlx::PgPool;
13
14/// Errors originating from the database layer.
15#[derive(Debug, thiserror::Error)]
16pub enum DbError {
17    /// A query or connection error from sqlx.
18    #[error("database error: {0}")]
19    Sqlx(#[from] sqlx::Error),
20
21    /// Failed to create or configure the connection pool.
22    #[error("pool error: {0}")]
23    Pool(String),
24
25    /// A migration failed to apply.
26    #[error("migration error: {0}")]
27    Migration(String),
28}