pub enum PgQueryPiece {
    Static(&'static str),
    Plain(String),
    Literal(String),
    InlLiteral(InlinableString),
    Bytea(Vec<u8>),
}
Expand description

A part of an SQL query text. The query is constructed by adding Plain pieces “as is” and escaping the Literal pieces.

For example, a properly escaped “SELECT ‘foo’” might be generated with

    use pg_async::PgQueryPiece::{Static as S, Literal as L};
    vec![S("SELECT "), L("foo".into)]

Variants

Static(&'static str)

Static strings are included in the query “as is”.

Plain(String)

Plain strings are included in the query “as is”.

Literal(String)

Literals are escaped with PQescapeLiteral (which also places them into the single quotes).

InlLiteral(InlinableString)

Literals are escaped with PQescapeLiteral (which also places them into the single quotes).

InlLiteral allows for small string optimization.

Bytea(Vec<u8>)

Binary data, escaped with PQescapeByteaConn. Single quotes aren’t added by the escape.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.