macro_rules! granular_operations {
($db_type:ident, $(($table_name:literal, $struct:ty)),+ $(,)?) => { ... };
}
Expand description
Macro that generates a static operation executor and serializer function, that given a granular operation, executes it, parses the result into the data structure corresponding to the table name, and serializes it to JSON. This is useful for simple operation processing, without real-time updates.
Example:
ⓘ
// Generate the function`
granular_operations!(sqlite, ("todos", Todo), ("users", User));
// Use it to execute a granular operation and serialize the result to JSON.
let serialized: serde_json::Value = granular_operation_static(operation, &pool).await;