Macro light_magic::join

source ยท
macro_rules! join {
    ($db:expr, $key:expr, $($table:ident => $field:ident),* $(,)?) => { ... };
}
Expand description

Joins Data of different Tables in the Database together

use light_magic::{db, join};

db! {
    Table<User> => { id: usize, name: String, kind: String },
    Table<Criminal> => { user_name: String, entry: String }
}

let db = Database::open_in_memory();
// Firstly specify the Database which should be used, then the key,
// and lastly the joined items with the field which will be compared with the key
let joined = join!(db.read(), "Nils", user => name, criminal => user_name);