Derive Macro django_query::IntoRow

source · []
#[derive(IntoRow)]
{
    // Attributes available to this derive:
    #[django]
}
Expand description

Derive the IntoRow trait, determining the display of nested objects.

This is only implemented for structs with named fields. All fields will be included in the output by default, which means they must have types which implement IntoCellValue. The annotations for this derive macro use the django attribute, which has the following significant options here:

  • #[django(rename="new_name")] Expose the annotated member in the output `new_name instead of using its name in the source code.

  • #[django(exclude)] Do not include the annotated member in any output.

  • #[django(foreign_key="field_name")] The field has a type which is itself IntoRow. Rather than requiring the field’s type to implement IntoCellValue, instead take the value of the field from the cell called field_name in the field’s own type’s output row.