Skip to main content

Crate dbkit_rs

Crate dbkit_rs 

Source
Expand description

Reusable Postgres + DuckDB database infrastructure.

Provides the foundational components for projects that use Postgres for writes and optionally DuckDB for analytical reads:

§Example

use dbkit::{ConnectionManager, BaseHandler, InitializationHandler};

let conn = ConnectionManager::new("postgres://localhost/myapp").await?;
let pool = std::sync::Arc::new(conn.pool().clone());

// Run migrations
let init = InitializationHandler::new(pool.clone());
let sql = "CREATE TABLE IF NOT EXISTS users (id SERIAL PRIMARY KEY, name TEXT)";
init.run_migrations(sql).await?;

// Use the handler for queries
let handler = BaseHandler::new(pool);

Re-exports§

pub use config::ConfigBuilder;
pub use config::DbkitConfig;
pub use config::SslMode;

Modules§

config

Structs§

BaseHandler
Core query executor for Postgres writes and optionally DuckDB reads.
Cache
Concurrent key-value cache with named buckets.
ConnectionManager
Postgres connection pool with automatic database creation.
InitializationHandler
Batch DDL migration executor with tracking.
PgRow
A row of data returned from the database by a query.
PoolStatus
Snapshot of connection pool health.

Enums§

DbkitError
FetchMode
How many rows to expect from a query.
QueryResult
Result wrapper for Postgres write queries.
WriteOp
Unified write operation types for Postgres.

Type Aliases§

Pool
Type alias for using deadpool::managed::Pool with tokio_postgres.