pub struct SQLBytes<'a>(pub Cow<'a, [u8]>);Expand description
Wrapper for byte slices to avoid list semantics (Vec<u8> normally becomes a list).
Use this when you want a single BLOB/bytea parameter:
ⓘ
use drizzle_core::{SQLBytes, SQL};
let data = vec![1u8, 2, 3];
let sql = SQL::bytes(&data); // or SQL::param(SQLBytes::new(&data))Tuple Fields§
§0: Cow<'a, [u8]>Implementations§
Trait Implementations§
Source§impl<'a, V> ToSQL<'a, V> for SQLBytes<'a>
impl<'a, V> ToSQL<'a, V> for SQLBytes<'a>
fn to_sql(&self) -> SQL<'a, V>
Source§fn into_sql(self) -> SQL<'a, V>where
Self: Sized,
fn into_sql(self) -> SQL<'a, V>where
Self: Sized,
Consume self and return SQL without cloning.
Default delegates to
to_sql() (which clones). Types that own their SQL
(like SQL and SQLExpr) override this to avoid the clone.fn alias(&self, alias: &'static str) -> SQL<'a, V>
Auto Trait Implementations§
impl<'a> Freeze for SQLBytes<'a>
impl<'a> RefUnwindSafe for SQLBytes<'a>
impl<'a> Send for SQLBytes<'a>
impl<'a> Sync for SQLBytes<'a>
impl<'a> Unpin for SQLBytes<'a>
impl<'a> UnwindSafe for SQLBytes<'a>
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