Expand description
Top-level PraxClient<E> and the prax::client! macro. See the
client module docs for usage.
Top-level Prax client grouping per-model accessors.
A PraxClient<E> owns a QueryEngine and routes operations to the
per-model Client<E> values emitted by #[derive(Model)] or
prax_schema!. The prax::client!(Foo, Bar, ...) declarative macro
attaches one accessor per model to PraxClient:
ⓘ
use prax_orm::{client, Model, PraxClient};
#[derive(Model)]
#[prax(table = "users")]
struct User { #[prax(id, auto)] id: i32, email: String }
#[derive(Model)]
#[prax(table = "posts")]
struct Post { #[prax(id, auto)] id: i32, title: String }
// Declares `trait PraxClientExt` with `user()`/`post()` accessors
// and implements it for `PraxClient<E>`. Call site has the trait in
// scope automatically because the macro emits it right there.
client!(User, Post);
let prax = PraxClient::new(engine);
let _ = prax.user().find_many();
let _ = prax.post().find_many();Structs§
- Prax
Client - Top-level client grouping every model’s per-model
Client<E>.