Skip to main content

FromRow

Derive Macro FromRow 

Source
#[derive(FromRow)]
{
    // Attributes available to this derive:
    #[keelson]
}
Expand description

The derive macros, re-exported behind the macros feature.

Bind writes the ToValue/FromValue pair for a newtype — the bound a keelson-gen column override must satisfy. FromRow maps a result row onto a struct; the trait it implements lives in keelson-exec, which any user of it already depends on. Both are documented in the keelson-macros crate.

keelson_core::Bind is the derive, keelson_exec::Bind the trait: two namespaces, so importing both is fine. Implement keelson_exec::FromRow by reading one column per field, by name.

#[keelson(rename = "column")] reads a differently named column; #[keelson(flatten)] reads a nested struct out of the same row. Named fields only. See the crate documentation for the full list of what is refused and why.