forked from apecloud/ape-dts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from apecloud/feat/rdb_dcl
feat: simple support for MySQL DCLs
- Loading branch information
Showing
30 changed files
with
1,102 additions
and
30 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
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,26 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use serde_json::json; | ||
|
||
use super::dcl_type::DclType; | ||
use crate::config::config_enums::DbType; | ||
use crate::meta::dcl_meta::dcl_statement::DclStatement; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)] | ||
pub struct DclData { | ||
pub default_schema: String, | ||
pub dcl_type: DclType, | ||
pub db_type: DbType, | ||
pub statement: DclStatement, | ||
} | ||
|
||
impl std::fmt::Display for DclData { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
write!(f, "{}", json!(self)) | ||
} | ||
} | ||
|
||
impl DclData { | ||
pub fn to_sql(&self) -> String { | ||
self.statement.to_sql(&self.db_type) | ||
} | ||
} |
Oops, something went wrong.