| Crates.io | nitinol-sqlite-adaptor |
| lib.rs | nitinol-sqlite-adaptor |
| version | 0.1.0 |
| created_at | 2025-03-25 07:38:20.345005+00 |
| updated_at | 2025-03-25 07:38:20.345005+00 |
| description | SQLite storage adapter for `nitinol-persistence`. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1604917 |
| size | 80,020 |
This is a simple adaptor to use Nitinol with SQLite databases.
#[tokio::test]
async fn main() -> anyhow::Result<()> {
// Initialize the sqlite inmemory eventstore
let eventstore = SqliteEventStore::setup("sqlite://:memory:").await?;
// Initialize the event writer
let writer = EventWriter::new(eventstore.clone()).set_retry(5);
// Install writer into global
nitinol::setup::set_writer(writer);
// It is recommended that the actual saving method
// be done at the beginning of the EventApplicator process.
//
// #[async_trait]
// impl EventApplicator<EntityEvent> for Entity {
// #[tracing::instrument(skip_all)]
// async fn apply(&mut self, event: EntityEvent, ctx: &mut Context) {
// self.persist(&event, ctx).await;
//
// match event {
// EntityEvent::Created => {
// tracing::debug!("Entity created.");
// }
// }
// }
// }
}