prax-armature

Crates.ioprax-armature
lib.rsprax-armature
version0.5.0
created_at2025-12-21 17:54:25.157632+00
updated_at2026-01-07 18:35:06.867299+00
descriptionArmature framework integration for Prax ORM
homepagehttps://github.com/pegasusheavy/prax-orm
repositoryhttps://github.com/pegasusheavy/prax-orm
max_upload_size
id1998391
size92,143
Joseph R. Quinn (quinnjr)

documentation

README

prax-armature

Armature framework integration for Prax ORM.

Overview

prax-armature provides seamless integration with the Armature HTTP framework using dependency injection.

Features

  • First-class DI integration with Armature
  • Singleton connection pool provider
  • Request-scoped transactions
  • DatabaseMiddleware for automatic connection handling

Usage

use armature::prelude::*;
use prax_armature::{PraxClient, PraxClientBuilder};

#[module_impl]
impl DatabaseModule {
    #[provider(singleton)]
    async fn prax_client() -> Arc<PraxClient> {
        let client = PraxClientBuilder::new()
            .url("postgresql://localhost/mydb")
            .build()
            .await
            .unwrap();
        Arc::new(client)
    }
}

#[controller("/users")]
impl UserController {
    #[get("/")]
    async fn list_users(
        &self,
        #[inject] db: Arc<PraxClient>,
    ) -> Result<Json<Vec<User>>, HttpError> {
        let users = db.user().find_many().exec().await?;
        Ok(Json(users))
    }
}

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Commit count: 0

cargo fmt