Enum pg_async::PgQueryPiece
source · 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
Auto Trait Implementations
impl RefUnwindSafe for PgQueryPiece
impl Send for PgQueryPiece
impl Sync for PgQueryPiece
impl Unpin for PgQueryPiece
impl UnwindSafe for PgQueryPiece
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more