Crate toql_fields_macro[−][src]
Expand description
The fields!
macro compiles a list of Toql field names into program code.
Any syntax errors or wrong field names will show up at compile time.
Wrong field names are detected because the field!
macro uses the
query builder functions that are genereated by the Toql derive.
Example
Assume a struct User
with a joined address
.
ⓘ
use toql_fields_macro::fields;
#[derive(Toql)]
struct User
#[toql(key)]
id: u64,
name: String,
#[toql(join())]
address: Address
}
#[derive(Toql)]
struct Address
#[toql(key)]
id: u64,
street: String
}
let f = fields!(User, "*, address_street");
Notice that the fields!
macro takes a type, however the resulting Fields
is untyped.
This is a shortcoming and will be resolved in the future.