rainier-orm-macros-1.0.0 has been yanked.
#[derive(Entity)] for rainier_orm.
From a plain struct it generates the Entity impl: table + column
metadata (column SQL type is deferred to the field type's SqlType
impl, so it stays open to new types), a row decoder (from_row, via
each field type's FromColumn), the insert/primary-key value projections
(via ToColumn), plus index and foreign-key constraint metadata. No
per-entity SQL is written by hand.
#[derive(Entity)]
#[orm(table = "posts")]
#[orm(index = "author_id, created_at")] // composite index
#[orm(unique = "author_id, slug")] // composite unique
struct Post {
#[orm(pk, auto_increment)]
id: u64,
#[orm(unique)] // single-column unique
slug: String,
#[orm(index, references = "users(id)", on_delete = "cascade")]
author_id: u64, // FK *id*, not a relationship
body: Option<String>, // nullable inferred from Option
#[orm(column = "created_at")]
created: chrono::DateTime<chrono::Utc>,
}