SqlFile

Struct SqlFile 

Source
pub struct SqlFile<F: AsyncWrite + Unpin + Send + Sync> { /* private fields */ }
Expand description

A file to output sql to

Implementations§

Source§

impl SqlFile<BufWriter<File>>

Source

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>

Source

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>

Source§

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>

Source§

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<()>

This should apply the DDL statements to the destination.
Source§

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<()>

Should begin a new transaction.
Source§

async fn commit_transaction(&mut self) -> Result<()>

Should commit a running transaction.
Source§

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.
Source§

async fn finish(&mut self) -> Result<()>

Source§

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.
Source§

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>

Source§

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

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>>

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>

Should create a destination that works with single threaded writing.
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more