Skip to main content

Crate magic_sync_derive

Crate magic_sync_derive 

Source
Expand description

#[derive(Row)] and #[derive(Columns)] for magic_sync: one struct is one table, column for column, and says how it travels. Use them through magic_sync, which re-exports both; every attribute is documented there, on magic_sync::Row.

Everything the derive is told is checked where it is written: a key that is not a field, a column named twice, an attribute a table of its kind cannot have, a key or version of a type the engine cannot read — each is a compile error pointing at the token that says it.

Derive Macros§

Columns
Implements magic_sync::Columns for a part of a row, which the row brings in with #[sqlx(flatten)]. Use it as magic_sync::Columns: its fields take the same #[row(…)] flags as a row’s, and the struct only crate.
Row
Implements magic_sync::Row for a struct that is one table, column for column. Use it as magic_sync::Row: the attributes it reads (#[row(…)] on the struct and its fields, and the #[sqlx(…)] keys that name a column) are documented there.