Trait sqlx_oldapi::prelude::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) -> IsNull
where 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 Encode<'_, Mssql> for &str

sourceยง

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

sourceยง

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

sourceยง

impl Encode<'_, Mssql> for bool

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, Mssql> for f32

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, Mssql> for f64

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, Mssql> for i8

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, Mssql> for i16

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, Mssql> for i32

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, Mssql> for i64

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, Mssql> for u8

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, Mssql> for String

sourceยง

impl Encode<'_, Mssql> for Vec<u8>

sourceยง

impl Encode<'_, MySql> for &str

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

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

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

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

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, MySql> for bool

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, MySql> for f32

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, MySql> for f64

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, MySql> for i8

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, MySql> for i16

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, MySql> for i32

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, MySql> for i64

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, MySql> for u8

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, MySql> for u16

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, MySql> for u32

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, MySql> for u64

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, MySql> for String

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, MySql> for Vec<u8>

sourceยง

fn encode_by_ref(&self, buf: &mut Vec<u8>) -> IsNull

sourceยง

impl Encode<'_, Postgres> for &str

sourceยง

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

sourceยง

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

sourceยง

impl Encode<'_, Postgres> for bool

sourceยง

impl Encode<'_, Postgres> for f32

sourceยง

impl Encode<'_, Postgres> for f64

sourceยง

impl Encode<'_, Postgres> for i8

sourceยง

impl Encode<'_, Postgres> for i16

sourceยง

impl Encode<'_, Postgres> for i32

sourceยง

impl Encode<'_, Postgres> for i64

sourceยง

impl Encode<'_, Postgres> for String

sourceยง

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

sourceยง

impl Encode<'_, Postgres> for Duration

sourceยง

impl Encode<'_, Postgres> for TimeDelta

sourceยง

impl Encode<'_, Postgres> for Duration

sourceยง

impl<'db> Encode<'db, Postgres> for IpAddr
where IpNetwork: Encode<'db, Postgres>,

sourceยง

impl<'q> Encode<'q, Any> for &'q str
where &'q str: AnyEncode<'q>,

sourceยง

impl<'q> Encode<'q, Any> for &'q [u8]
where &'q [u8]: AnyEncode<'q>,

sourceยง

impl<'q> Encode<'q, Any> for bool
where bool: AnyEncode<'q>,

sourceยง

impl<'q> Encode<'q, Any> for f32
where f32: AnyEncode<'q>,

sourceยง

impl<'q> Encode<'q, Any> for f64
where f64: AnyEncode<'q>,

sourceยง

impl<'q> Encode<'q, Any> for i16
where i16: AnyEncode<'q>,

sourceยง

impl<'q> Encode<'q, Any> for i32
where i32: AnyEncode<'q>,

sourceยง

impl<'q> Encode<'q, Any> for i64
where i64: AnyEncode<'q>,

sourceยง

impl<'q> Encode<'q, Any> for String
where String: AnyEncode<'q>,

sourceยง

impl<'q> Encode<'q, Any> for Vec<u8>
where Vec<u8>: AnyEncode<'q>,

sourceยง

impl<'q> Encode<'q, Sqlite> for &'q str

sourceยง

impl<'q> Encode<'q, Sqlite> for &'q [u8]

sourceยง

impl<'q> Encode<'q, Sqlite> for Cow<'q, str>

sourceยง

impl<'q> Encode<'q, Sqlite> for bool

sourceยง

impl<'q> Encode<'q, Sqlite> for f32

sourceยง

impl<'q> Encode<'q, Sqlite> for f64

sourceยง

impl<'q> Encode<'q, Sqlite> for i8

sourceยง

impl<'q> Encode<'q, Sqlite> for i16

sourceยง

impl<'q> Encode<'q, Sqlite> for i32

sourceยง

impl<'q> Encode<'q, Sqlite> for i64

sourceยง

impl<'q> Encode<'q, Sqlite> for u8

sourceยง

impl<'q> Encode<'q, Sqlite> for u16

sourceยง

impl<'q> Encode<'q, Sqlite> for u32

sourceยง

impl<'q> Encode<'q, Sqlite> for String

sourceยง

impl<'q> Encode<'q, Sqlite> for Vec<u8>

sourceยง

impl<'q, T> Encode<'q, Any> for Option<T>
where T: AnyEncode<'q> + 'q,

sourceยง

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

sourceยง

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

sourceยง

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

sourceยง

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

sourceยง

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

sourceยง

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

sourceยง

impl<'q, T, DB> Encode<'q, DB> for &T
where 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<'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<'r> Encode<'_, Mssql> for Cow<'r, [u8]>

sourceยง

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

Implementorsยง

sourceยง

impl Encode<'_, Mssql> for NaiveDate

Encodes Date objects for transfer over the wire

sourceยง

impl Encode<'_, Mssql> for NaiveDateTime

Encodes DateTime objects for transfer over the wire

sourceยง

impl Encode<'_, Mssql> for NaiveTime

Encodes Time objects for transfer over the wire

sourceยง

impl Encode<'_, Mssql> for BigDecimal

sourceยง

impl Encode<'_, Mssql> for Decimal

sourceยง

impl Encode<'_, MySql> for DateTime<Local>

Note: assumes the connectionโ€™s time_zone is set to +00:00 (UTC).

sourceยง

impl Encode<'_, MySql> for DateTime<Utc>

Note: assumes the connectionโ€™s time_zone is set to +00:00 (UTC).

sourceยง

impl Encode<'_, MySql> for NaiveDate

sourceยง

impl Encode<'_, MySql> for NaiveDateTime

sourceยง

impl Encode<'_, MySql> for NaiveTime

sourceยง

impl Encode<'_, MySql> for BigDecimal

sourceยง

impl Encode<'_, MySql> for Decimal

sourceยง

impl Encode<'_, MySql> for Uuid

sourceยง

impl Encode<'_, MySql> for Date

sourceยง

impl Encode<'_, MySql> for OffsetDateTime

sourceยง

impl Encode<'_, MySql> for PrimitiveDateTime

sourceยง

impl Encode<'_, MySql> for Time

sourceยง

impl Encode<'_, MySql> for Hyphenated

sourceยง

impl Encode<'_, Postgres> for IpNetwork

sourceยง

impl Encode<'_, Postgres> for sqlx_oldapi::postgres::types::Oid

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

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 MacAddress

sourceยง

impl Encode<'_, Postgres> for BigDecimal

ยงPanics

If this BigDecimal cannot be represented by PgNumeric.

sourceยง

impl Encode<'_, Postgres> for BitVec

sourceยง

impl Encode<'_, Postgres> for Decimal

ยงPanics

If this Decimal cannot be represented by PgNumeric.

sourceยง

impl Encode<'_, Postgres> for Uuid

sourceยง

impl Encode<'_, Postgres> for Date

sourceยง

impl Encode<'_, Postgres> for OffsetDateTime

sourceยง

impl Encode<'_, Postgres> for PrimitiveDateTime

sourceยง

impl Encode<'_, Postgres> for Time

sourceยง

impl Encode<'_, Sqlite> for NaiveDate

sourceยง

impl Encode<'_, Sqlite> for NaiveDateTime

sourceยง

impl Encode<'_, Sqlite> for NaiveTime

sourceยง

impl Encode<'_, Sqlite> for BigDecimal

sourceยง

impl Encode<'_, Sqlite> for Decimal

sourceยง

impl Encode<'_, Sqlite> for Date

sourceยง

impl Encode<'_, Sqlite> for OffsetDateTime

sourceยง

impl Encode<'_, Sqlite> for PrimitiveDateTime

sourceยง

impl Encode<'_, Sqlite> for Time

sourceยง

impl<'q> Encode<'q, Any> for Value
where Value: AnyEncode<'q>,

sourceยง

impl<'q> Encode<'q, Any> for DateTime<Local>
where DateTime<Local>: AnyEncode<'q>,

sourceยง

impl<'q> Encode<'q, Any> for DateTime<Utc>
where DateTime<Utc>: AnyEncode<'q>,

sourceยง

impl<'q> Encode<'q, Any> for NaiveDate
where NaiveDate: AnyEncode<'q>,

sourceยง

impl<'q> Encode<'q, Any> for NaiveDateTime

sourceยง

impl<'q> Encode<'q, Any> for NaiveTime
where NaiveTime: AnyEncode<'q>,

sourceยง

impl<'q> Encode<'q, Any> for BigDecimal
where BigDecimal: AnyEncode<'q>,

sourceยง

impl<'q> Encode<'q, Any> for Decimal
where Decimal: AnyEncode<'q>,

sourceยง

impl<'q> Encode<'q, Sqlite> for Uuid

sourceยง

impl<'q> Encode<'q, Sqlite> for Hyphenated

sourceยง

impl<'q, DB> Encode<'q, DB> for &'q BStr
where DB: Database, &'q [u8]: Encode<'q, DB>,

sourceยง

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

sourceยง

impl<'q, DB> Encode<'q, DB> for BString
where DB: Database, Vec<u8>: Encode<'q, DB>,

sourceยง

impl<'q, DB> Encode<'q, DB> for sqlx_oldapi::types::git2::Oid
where DB: Database, Vec<u8>: Encode<'q, DB>,

sourceยง

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

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<T> Encode<'_, Mssql> for DateTime<T>
where T: TimeZone,

sourceยง

impl<T> Encode<'_, MySql> for Json<T>
where T: Serialize,

sourceยง

impl<T> Encode<'_, Sqlite> for Json<T>
where T: Serialize,

sourceยง

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

sourceยง

impl<Tz> Encode<'_, Sqlite> for DateTime<Tz>
where Tz: TimeZone, <Tz as TimeZone>::Offset: Display,