Skip to main content

batch

Function batch 

Source
pub fn batch<Q>(queries: Q) -> Batch<<Q as IntoStatement>::Returning>
Expand description

Compose multiple independent queries into a single batched statement.

The queries are sent to the database in a single round-trip and the results come back as a typed tuple matching the input queries.

§Examples

ⓘ
let (active_users, recent_posts) = toasty::batch((
    User::find_by_active(true),
    Post::find_recent(100),
)).exec(&mut db).await?;