[][src]Macro rql::schema

macro_rules! schema {
    ($(#[$struct_attr:meta])* $name:ident { $($table:ident: $type:ty),* $(,)* }) => { ... };
    ($(#[$struct_attr:meta])* pub $name:ident { $($table:ident: $type:ty),* $(,)* }) => { ... };
    (impl $name:ident { $($table:ident: $type:ty),* }) => { ... };
}

Macro for generating a schema struct

schema! generates the structure itself as well as necessary function impls.

Example

use rql::prelude::*;

#[derive(Serialize, Deserialize)]
struct Person {
    name: String,
    age: usize,
}

#[derive(Serialize, Deserialize)]
struct Account {
    owner: Id<Person>,
    balance: f32,
}

// Define the schema
schema! {
    SchemaA {
        person: Person,
        account: Account,
    }
}