Expand description
Procedural macros for hyperdb-api.
Currently exposes #[derive(FromRow)], which generates an
hyperdb_api::FromRow impl for a struct by mapping each field
to a column with the matching name.
Re-exported by hyperdb-api so callers don’t need to add this
crate as a direct dependency. Use it as use hyperdb_api::FromRow;
and #[derive(FromRow)] on a struct.
§Example
ⓘ
use hyperdb_api::FromRow;
#[derive(FromRow)]
struct User {
id: i32,
name: String,
// Map to a different column name with `rename`:
#[hyperdb(rename = "email_address")]
email: Option<String>,
}§Attributes
#[hyperdb(rename = "...")]on a field uses the given column name instead of the field name.#[hyperdb(index = N)]on a field uses positional access (RowAccessor::position/RowAccessor::position_opt) at column indexNinstead of name-based lookup. Mutually exclusive withrename.- Field types of
Option<T>useRowAccessor::get_opt/RowAccessor::position_opt(NULL →None); other field types useRowAccessor::get/RowAccessor::position(NULL → error).
Derive Macros§
- FromRow
- Derives
hyperdb_api::FromRowfor a struct.