macro_rules! serialize_rows_static {
($db_type:ident, $(($table_name:literal, $struct:ty)),+ $(,)?) => { ... };
}
Expand description
Macro that generates the static rows serialization dispatcher function, that given sqlite rows, serializes them to the appropriate model based on the table name.
Example:
ⓘ
// Generate the function
serialize_rows_static!(sqlite, ("todos", Todo), ("users", User));
// Use it to serialize `QueryData<Row>` to JSON, with a table name.
let serialized: serde_json::Value = serialize_rows_static(&rows, "todos");