Macro airone::airone_bulk

source ·
macro_rules! airone_bulk {
    ($db: ident, $body: block) => { ... };
}
Expand description

Wraps multiple instructions as a single bulk operation

Wraps the given body in this way:

  • temporarily disable autocommit
  • commit() old data in memory
  • execute the body you provided
  • commit() again
  • activate autocommit if it was first enabled

Data is rolledback if there’s a non-panicking error

airone_bulk!(
    db,
    {
        db.push(Foo {
            field1: 0.0
        });
        db.push(Foo {
            field1: 5.0
        });
    }
);