substreams-sink-database-changes
contains all the definitions for database changes which can be emitted by a substream.
```bash
cargo add substreams-database-change ```
Cargo.toml
toml
[dependencies]
substreams = "0.5"
substreams-database-change = "1.0"
src/lib.rs
```rust use substreams::errors::Error; use substreamsdatabasechange::pb::database::{DatabaseChanges, table_change::Operation};
fn dbout(
... some stores ...
) -> Result
// Push change
database_changes.push_change("transfer", "primary-key", 0, Operation::Create)
.change("key1", ("previous1", "value1"))
.change("key2", ("previous2", "value2"))
Ok(database_changes)
} ```
Be sure to have buf
CLI installed (https://buf.build/docs/installation/) and run:
bash
buf generate proto