armature-diesel

Crates.ioarmature-diesel
lib.rsarmature-diesel
version0.1.0
created_at2025-12-27 03:08:34.80837+00
updated_at2025-12-27 03:08:34.80837+00
descriptionDiesel async database integration for the Armature framework
homepagehttps://pegasusheavy.github.io/armature
repositoryhttps://github.com/pegasusheavy/armature
max_upload_size
id2006625
size92,428
Joseph R. Quinn (quinnjr)

documentation

README

armature-diesel

Diesel async database integration for the Armature framework.

Features

  • Async/Await - Non-blocking database operations
  • Connection Pooling - deadpool, bb8, mobc support
  • PostgreSQL - Full PostgreSQL support
  • MySQL - MySQL/MariaDB support
  • Transactions - ACID-compliant transactions
  • Migrations - Diesel migration support

Installation

[dependencies]
armature-diesel = "0.1"

Quick Start

use armature_diesel::{Pool, establish_pool};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let pool = establish_pool("postgres://localhost/mydb").await?;

    // Query
    let users = pool.interact(|conn| {
        users::table.load::<User>(conn)
    }).await??;

    // Transaction
    pool.transaction(|conn| {
        diesel::insert_into(users::table)
            .values(&new_user)
            .execute(conn)?;
        diesel::insert_into(profiles::table)
            .values(&profile)
            .execute(conn)
    }).await??;

    Ok(())
}

Pool Configuration

let pool = Pool::builder()
    .max_size(20)
    .min_idle(5)
    .connection_timeout(Duration::from_secs(5))
    .build("postgres://localhost/mydb")
    .await?;

License

MIT OR Apache-2.0

Commit count: 0

cargo fmt