pub struct SqlFile<F: AsyncWrite + Unpin + Send + Sync> { /* private fields */ }Expand description
A file to output sql to
Implementations§
Source§impl SqlFile<BufWriter<File>>
impl SqlFile<BufWriter<File>>
Sourcepub async fn new_file(
path: &str,
identifier_quoter: Arc<IdentifierQuoter>,
options: SqlFileOptions,
) -> Result<Self>
pub async fn new_file( path: &str, identifier_quoter: Arc<IdentifierQuoter>, options: SqlFileOptions, ) -> Result<Self>
Create a new SqlFile from a file path.
This automatically creates a new file and returns a SqlFile that writes to it.
Source§impl<F: AsyncWrite + Unpin + Send + Sync> SqlFile<F>
impl<F: AsyncWrite + Unpin + Send + Sync> SqlFile<F>
Sourcepub async fn new(
file: F,
identifier_quoter: Arc<IdentifierQuoter>,
options: SqlFileOptions,
) -> Result<Self>
pub async fn new( file: F, identifier_quoter: Arc<IdentifierQuoter>, options: SqlFileOptions, ) -> Result<Self>
Create a new SqlFile from a file-like object. This does not do any additional buffering
so it’s recommended to use a BufWriter or similar.
Trait Implementations§
Source§impl<F: AsyncWrite + Unpin + Send + Sync> BaseCopyTarget for SqlFile<F>
impl<F: AsyncWrite + Unpin + Send + Sync> BaseCopyTarget for SqlFile<F>
Source§async fn supported_data_format(&self) -> Result<Vec<DataFormat>>
async fn supported_data_format(&self) -> Result<Vec<DataFormat>>
Which data format is supported by this destination/source.
Source§impl<F: AsyncWrite + Unpin + Send + Sync> CopyDestination for &mut SqlFile<F>
impl<F: AsyncWrite + Unpin + Send + Sync> CopyDestination for &mut SqlFile<F>
Source§async fn apply_data<S: Stream<Item = Result<Bytes>> + Send, C: AsyncCleanup>(
&mut self,
schema: &PostgresSchema,
table: &PostgresTable,
data: TableData<S, C>,
) -> Result<()>
async fn apply_data<S: Stream<Item = Result<Bytes>> + Send, C: AsyncCleanup>( &mut self, schema: &PostgresSchema, table: &PostgresTable, data: TableData<S, C>, ) -> Result<()>
This should apply the data to the destination. The data is expected to be in the
format returned by
supported_data_format, if possible.Source§async fn apply_transactional_statement(&mut self, statement: &str) -> Result<()>
async fn apply_transactional_statement(&mut self, statement: &str) -> Result<()>
This should apply the DDL statements to the destination.
Source§async fn apply_non_transactional_statement(
&mut self,
statement: &str,
) -> Result<()>
async fn apply_non_transactional_statement( &mut self, statement: &str, ) -> Result<()>
This should apply the DDL statements to the destination.
These commands has to be run outside a transaction, as they might fail otherwise.
Source§async fn begin_transaction(&mut self) -> Result<()>
async fn begin_transaction(&mut self) -> Result<()>
Should begin a new transaction.
Source§async fn commit_transaction(&mut self) -> Result<()>
async fn commit_transaction(&mut self) -> Result<()>
Should commit a running transaction.
Source§fn get_identifier_quoter(&self) -> Arc<IdentifierQuoter>
fn get_identifier_quoter(&self) -> Arc<IdentifierQuoter>
Should get the identifier quoter that works with this destination. This ensures
quoting respects the rules of the destination, not the source.
async fn finish(&mut self) -> Result<()>
Source§fn try_introspect(
&self,
) -> impl Future<Output = Result<Option<PostgresDatabase>>> + Send
fn try_introspect( &self, ) -> impl Future<Output = Result<Option<PostgresDatabase>>> + Send
Should try to introspect the destination. If introspection is not supported, this should return
Ok(None),
not an error. Errors should only be returned if introspection is supported, but failed.fn has_data_in_table( &self, _schema: &PostgresSchema, _table: &PostgresTable, ) -> impl Future<Output = Result<bool>> + Send
Source§impl<'a, F: AsyncWrite + Unpin + Send + Sync + 'a> CopyDestinationFactory<'a> for SqlFile<F>
impl<'a, F: AsyncWrite + Unpin + Send + Sync + 'a> CopyDestinationFactory<'a> for SqlFile<F>
Source§type SequentialDestination = &'a mut SqlFile<F>
type SequentialDestination = &'a mut SqlFile<F>
The implementation type when dealing with single-threaded workloads. The can optionally
support multi-threading, but it is not needed.
Source§type ParallelDestination = ParallelCopyDestinationNotAvailable
type ParallelDestination = ParallelCopyDestinationNotAvailable
The implementation type when dealing with multithreaded workloads. This type has to support
multi-threading.
Source§async fn create_destination(
&'a mut self,
) -> Result<SequentialOrParallel<Self::SequentialDestination, Self::ParallelDestination>>
async fn create_destination( &'a mut self, ) -> Result<SequentialOrParallel<Self::SequentialDestination, Self::ParallelDestination>>
Should create whatever type is needed to be able to write data to the destination.
Source§async fn create_sequential_destination(
&'a mut self,
) -> Result<Self::SequentialDestination>
async fn create_sequential_destination( &'a mut self, ) -> Result<Self::SequentialDestination>
Should create a destination that works with single threaded writing.
Source§fn supported_parallelism(&self) -> SupportedParallelism
fn supported_parallelism(&self) -> SupportedParallelism
Should return what kind of parallelism is supported by the destination. This is used
for negotiation with the source.
Auto Trait Implementations§
impl<F> Freeze for SqlFile<F>where
F: Freeze,
impl<F> RefUnwindSafe for SqlFile<F>where
F: RefUnwindSafe,
impl<F> Send for SqlFile<F>
impl<F> Sync for SqlFile<F>
impl<F> Unpin for SqlFile<F>
impl<F> UnwindSafe for SqlFile<F>where
F: UnwindSafe,
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