Skip to main content

mysql_replication/
lib.rs

1#![forbid(unsafe_code)]
2//! MySQL replication with configuration-driven, committed event handlers.
3//!
4//! ```no_run
5//! use mysql_replication::{Event, Replication, Result, config::AppConfig};
6//! use std::path::Path;
7//!
8//! fn main() -> Result<()> {
9//!     let config = AppConfig::read(Path::new("cdc.toml"))?;
10//!     let mut replication = Replication::new(config)?;
11//!     replication.add_handle(|event: Event<'_>| {
12//!         for change in event.changes {
13//!             println!("{} {:?} {:?}", event.source_id, change.operation, change.pk);
14//!         }
15//!         Ok(())
16//!     });
17//!     replication.run()
18//! }
19//! ```
20
21pub mod config;
22pub mod engine;
23pub mod error;
24pub mod model;
25pub mod protocol;
26pub mod replication;
27pub mod sink;
28pub mod source;
29
30pub use error::{Error, Result};
31pub use model::{Change, ColumnMeta, Operation, OwnedChange, PrimaryKey, TableMeta};
32pub use protocol::mysql::Decoder;
33pub use replication::{Event, EventHandler, Replication};