Trait sqlx::Encode

source ·
pub trait Encode<'q, DB>where
    DB: Database,{
    // Required method
    fn encode_by_ref(
        &self,
        buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer
    ) -> IsNull;

    // Provided methods
    fn encode(
        self,
        buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer
    ) -> IsNull
       where Self: Sized { ... }
    fn produces(&self) -> Option<<DB as Database>::TypeInfo> { ... }
    fn size_hint(&self) -> usize { ... }
}
Expand description

Encode a single value to be sent to the database.

Required Methods§

source

fn encode_by_ref( &self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer ) -> IsNull

Writes the value of self into buf without moving self.

Where possible, make use of encode instead as it can take advantage of re-using memory.

Provided Methods§

source

fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNullwhere Self: Sized,

Writes the value of self into buf in the expected format for the database.

source

fn produces(&self) -> Option<<DB as Database>::TypeInfo>

source

fn size_hint(&self) -> usize

Implementations on Foreign Types§

source§

impl<'q, T, DB> Encode<'q, DB> for &Twhere DB: Database, T: Encode<'q, DB>,

source§

fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNull

source§

fn encode_by_ref( &self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer ) -> IsNull

source§

fn produces(&self) -> Option<<DB as Database>::TypeInfo>

source§

fn size_hint(&self) -> usize

source§

impl Encode<'_, Postgres> for Duration

source§

impl Encode<'_, Postgres> for Box<str, Global>

source§

impl<'q, T> Encode<'q, Postgres> for Vec<T, Global>where &'a [T]: for<'a> Encode<'q, Postgres>, T: Encode<'q, Postgres>,

source§

impl Encode<'_, Postgres> for i16

source§

impl Encode<'_, Postgres> for f64

source§

impl<const N: usize> Encode<'_, Postgres> for [u8; N]

source§

impl<'q, T> Encode<'q, Postgres> for Option<T>where T: Encode<'q, Postgres> + Type<Postgres> + 'q,

source§

impl Encode<'_, Postgres> for Duration

source§

impl Encode<'_, Postgres> for Box<[u8], Global>

source§

impl Encode<'_, Postgres> for Cow<'_, str>

source§

impl Encode<'_, Postgres> for &[u8]

source§

impl Encode<'_, Postgres> for &str

source§

impl<'q, T, const N: usize> Encode<'q, Postgres> for [T; N]where &'a [T]: for<'a> Encode<'q, Postgres>, T: Encode<'q, Postgres>,

source§

impl Encode<'_, Postgres> for f32

source§

impl<'q, T> Encode<'q, Postgres> for &[T]where T: Encode<'q, Postgres> + Type<Postgres>,

source§

impl Encode<'_, Postgres> for i64

source§

impl Encode<'_, Postgres> for i32

source§

impl Encode<'_, Postgres> for i8

source§

impl Encode<'_, Postgres> for String

source§

impl Encode<'_, Postgres> for Vec<u8, Global>

source§

impl Encode<'_, Postgres> for bool

Implementors§

source§

impl Encode<'_, Postgres> for Oid

source§

impl Encode<'_, Postgres> for PgCiText

source§

impl Encode<'_, Postgres> for PgInterval

source§

impl Encode<'_, Postgres> for PgLQuery

source§

impl Encode<'_, Postgres> for PgLTree

source§

impl Encode<'_, Postgres> for PgMoney

source§

impl Encode<'_, Postgres> for PgTimeTz<NaiveTime, FixedOffset>

source§

impl Encode<'_, Postgres> for NaiveDate

source§

impl Encode<'_, Postgres> for NaiveDateTime

source§

impl Encode<'_, Postgres> for NaiveTime

source§

impl Encode<'_, Postgres> for Uuid

source§

impl<'q, DB> Encode<'q, DB> for Valuewhere Json<&'a Value>: for<'a> Encode<'q, DB>, DB: Database,

source§

impl<'q, T> Encode<'q, Postgres> for PgRange<T>where T: Encode<'q, Postgres>,

source§

impl<'q, T> Encode<'q, Postgres> for Json<T>where T: Serialize,

source§

impl<'q, T> Encode<'q, Postgres> for Text<T>where T: Display,

source§

impl<Tz> Encode<'_, Postgres> for DateTime<Tz>where Tz: TimeZone,