mysql_canal/lib.rs
1#![forbid(unsafe_code)]
2//! MySQL CDC conversion, committed transactions and checkpoint management.
3//!
4//! ```no_run
5//! use mysql_canal::{CommittedTransaction, Canal, Result, config::AppConfig};
6//! use std::path::Path;
7//!
8//! fn main() -> Result<()> {
9//! let config = AppConfig::read(Path::new("canal.toml"))?;
10//! let mut canal = Canal::new(config)?;
11//! canal.add_handle(|event: CommittedTransaction<'_>| {
12//! for change in event.changes {
13//! println!("{} {:?} {:?}", event.source_id, change.operation, change.pk);
14//! }
15//! Ok(())
16//! });
17//! canal.run()
18//! }
19//! ```
20
21pub mod config;
22pub mod engine;
23pub mod error;
24pub mod model;
25pub mod protocol;
26pub mod sink;
27pub mod source;
28
29pub use engine::Canal;
30pub use error::{Error, Result, RunError, SourceFailure};
31pub use model::{
32 CdcImageMode, Change, ColumnMeta, CommittedTransaction, DecimalValue, Field, FieldImage,
33 Fields, Full, IntegerValue, Minimal, Operation, OwnedChange, OwnedFieldImage, PrimaryKey,
34 RowOperation, RowValue, TableMeta,
35};
36pub use protocol::mysql::Decoder;
37pub use sink::TransactionHandler;