2022-09-29 22:17:06 +08:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use time::OffsetDateTime;
|
|
|
|
|
2022-10-02 19:24:59 +08:00
|
|
|
mod error;
|
2022-10-03 22:12:01 +08:00
|
|
|
mod reader;
|
2022-10-02 19:24:59 +08:00
|
|
|
mod writer;
|
|
|
|
|
|
|
|
pub use error::Error;
|
|
|
|
pub use writer::DumpWriter;
|
2022-09-29 22:17:06 +08:00
|
|
|
|
2022-10-03 22:12:01 +08:00
|
|
|
const CURRENT_DUMP_VERSION: Version = Version::V6;
|
2022-09-29 22:17:06 +08:00
|
|
|
|
|
|
|
type Result<T> = std::result::Result<T, Error>;
|
|
|
|
|
|
|
|
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
|
|
#[serde(rename_all = "camelCase")]
|
|
|
|
struct Metadata {
|
2022-10-03 22:12:01 +08:00
|
|
|
pub dump_version: Version,
|
2022-09-29 22:17:06 +08:00
|
|
|
pub db_version: String,
|
2022-10-03 22:12:01 +08:00
|
|
|
#[serde(with = "time::serde::rfc3339")]
|
2022-09-29 22:17:06 +08:00
|
|
|
pub dump_date: OffsetDateTime,
|
|
|
|
}
|
2022-10-03 22:12:01 +08:00
|
|
|
|
|
|
|
#[derive(Debug, PartialEq, Eq, Deserialize, Serialize)]
|
|
|
|
pub enum Version {
|
|
|
|
V1,
|
|
|
|
V2,
|
|
|
|
V3,
|
|
|
|
V4,
|
|
|
|
V5,
|
|
|
|
V6,
|
|
|
|
}
|