nautilus-orm-codegen 1.0.1

Code generator for Nautilus ORM schema files
Documentation
/// {{ model_name }} model.
///
/// PK fields are always present. All other scalar fields are `Option<T>`:
/// they are `Some(value)` when the column was included in the query result
/// (default, or explicitly selected via `select`), and `None` when the
/// column was omitted through projection.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct {{ model_name }} {
{%- for field in scalar_fields %}
{%- if field.is_pk %}
    pub {{ field.name }}: {{ field.rust_type }},
{%- else %}
    pub {{ field.name }}: Option<{{ field.rust_type }}>,
{%- endif %}
{%- endfor %}
{%- for field in relation_fields %}
    #[serde(default, alias = "{{ field.name }}_json")]
    /// Relation field (lazy-loaded)
    pub {{ field.name }}: {{ field.rust_type }},
{%- endfor %}
}