cnc_rs/db/db_operations.rs
1use anyhow::Result;
2
3/// Trait defining basic operations for interacting with a database.
4///
5/// Types implementing this trait can be used with the `DBOperations` struct for managing database logic.
6pub trait DatabaseOperations {
7 /// Establishes a connection to the database.
8 fn connect(&mut self) -> Result<(), anyhow::Error>;
9
10 /// Closes the database connection.
11 fn close(&mut self) -> Result<(), anyhow::Error>;
12
13 /// Replicates the database state.
14 fn replicate(&mut self) -> Result<(), anyhow::Error>;
15}