Skip to main content

doc

Macro doc 

Source
macro_rules! doc {
    ($query:expr) => { ... };
    ($query:expr, { $( $k:tt : $v:tt ),* $(,)? }) => { ... };
}
Expand description

Creates a (String, ExecutionOptions) tuple to be executed by db.execute().

This macro is the primary way to execute parametrized AQL queries and mutations in Rust. It automatically binds Rust variables to AQL variables using the native Aurora Value system, ensuring safety and performance.

ยงExamples

let min_age = 18;

// Simple query without variables
let res = db.execute(doc!("query { users { id name } }")).await?;

// Query with variables
let res = db.execute(doc!(
    "query($minAge: Int) {
        users(where: { age: { gte: $minAge } }) {
            name
        }
    }",
    { "minAge": min_age }
)).await?;