pub struct DataTransfer { /* private fields */ }Expand description
数据转移核心逻辑
Implementations§
Source§impl DataTransfer
impl DataTransfer
pub fn new( source_db: Box<dyn DatabaseConnection>, target_db: Box<dyn DatabaseConnection>, ) -> Self
pub fn with_options(self, options: TransferOptions) -> Self
Sourcepub async fn transfer(
&self,
mappings: Vec<FieldMapping>,
) -> Result<TransferReport>
pub async fn transfer( &self, mappings: Vec<FieldMapping>, ) -> Result<TransferReport>
执行数据转移(带进度报告)
Sourcepub async fn execute_transfer(
&self,
select_sql: &str,
insert_sql: &str,
) -> Result<()>
pub async fn execute_transfer( &self, select_sql: &str, insert_sql: &str, ) -> Result<()>
执行具体的数据转移(保留兼容性)
Sourcepub async fn auto_match_fields(
&self,
source_table: &str,
target_table: &str,
) -> Result<Vec<FieldMapping>>
pub async fn auto_match_fields( &self, source_table: &str, target_table: &str, ) -> Result<Vec<FieldMapping>>
智能匹配字段映射
Sourcepub async fn copy_data(
&self,
source_table: &str,
target_table: &str,
) -> Result<()>
pub async fn copy_data( &self, source_table: &str, target_table: &str, ) -> Result<()>
直接复制数据(表结构相同)
Sourcepub async fn generate_auto_mappings(
&self,
source_table: &str,
target_table: &str,
) -> Result<Vec<FieldMapping>>
pub async fn generate_auto_mappings( &self, source_table: &str, target_table: &str, ) -> Result<Vec<FieldMapping>>
生成自动字段映射
Auto Trait Implementations§
impl Freeze for DataTransfer
impl !RefUnwindSafe for DataTransfer
impl !Send for DataTransfer
impl !Sync for DataTransfer
impl Unpin for DataTransfer
impl UnsafeUnpin for DataTransfer
impl !UnwindSafe for DataTransfer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more