-
-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a3e612
commit bd3d9af
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use std::{path::PathBuf, str::FromStr}; | ||
|
||
use crate::{Mbtiles, MbtError, MbtResult, is_empty_database}; | ||
|
||
impl Mbtiles { | ||
pub async fn diff(&self, dst_path: PathBuf, diff_path: PathBuf) -> MbtResult<()>{ | ||
let src_path = PathBuf::from_str(self.filepath()).unwrap(); | ||
|
||
if src_path == dst_path { | ||
return Err(MbtError::SameSourceAndDestination(dst_path.clone())); | ||
} | ||
if src_path == diff_path || dst_path == diff_path { | ||
return Err(MbtError::SameDiffAndSourceOrDestination(diff_path.clone())); | ||
} | ||
|
||
let dst_mbt = Mbtiles::new(&dst_path)?; | ||
|
||
let mut dst_conn = dst_mbt.open_or_new().await?; | ||
|
||
let is_empty_db = is_empty_database(&mut dst_conn).await?; | ||
if !is_empty_db { | ||
return Err(MbtError::NonEmptyTargetFile(dst_path.clone())); | ||
} | ||
|
||
self.attach_to(&mut dst_conn, "sourceDb").await?; | ||
|
||
todo!() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
pub use sqlx; | ||
|
||
mod copier; | ||
mod diff; | ||
pub use copier::{CopyDuplicateMode, MbtilesCopier}; | ||
|
||
mod errors; | ||
|