Skip to main content

CopyTo

Struct CopyTo 

Source
pub struct CopyTo {
    pub plan: Plan,
    pub path: String,
    pub header: bool,
    pub delimiter: String,
    pub quote: String,
    pub escape: String,
    pub null: String,
    pub force_quote: Vec<String>,
    pub force_quote_all: bool,
    pub json: bool,
    pub array: bool,
}
Expand description

A bound COPY ... TO a CSV or a JSON file, with every option read and defaulted.

The CSV defaults are the pin’s: a header line, a comma, a double quote that is its own escape, and a null written as nothing at all. The escape does not follow the quote, so QUOTE '''' alone still escapes with a double quote, which is what the pin writes.

Fields§

§plan: Plan

The query whose rows are written.

§path: String

The file.

§header: bool

Whether the first line names the columns.

§delimiter: String

What goes between two values.

§quote: String

What a value is quoted with.

§escape: String

What comes before a quote inside a quoted value.

§null: String

What a null is written as.

§force_quote: Vec<String>

The columns every value of which is quoted, by name.

§force_quote_all: bool

Whether every column is, which is FORCE_QUOTE *.

§json: bool

Whether the file is JSON rather than CSV, and the CSV options above are left alone.

§array: bool

For JSON, whether the rows go in one array rather than one object a line.

Trait Implementations§

Source§

impl Debug for CopyTo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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, 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.