sqlx

Trait Encode

Source
pub trait Encode<'q, DB>
where DB: Database,
{ // Required method fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>; // Provided methods fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>> 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 Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

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 Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
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<'_, MySql> for &str

Source§

fn encode_by_ref( &self, buf: &mut Vec<u8>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut Vec<u8>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut Vec<u8>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, MySql> for IpAddr

Source§

fn encode_by_ref( &self, buf: &mut Vec<u8>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, MySql> for bool

Source§

fn encode_by_ref( &self, buf: &mut Vec<u8>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, MySql> for f32

Source§

fn encode_by_ref( &self, buf: &mut Vec<u8>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, MySql> for f64

Source§

fn encode_by_ref( &self, buf: &mut Vec<u8>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, MySql> for i8

Source§

fn encode_by_ref( &self, buf: &mut Vec<u8>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, MySql> for i16

Source§

fn encode_by_ref( &self, buf: &mut Vec<u8>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, MySql> for i32

Source§

fn encode_by_ref( &self, buf: &mut Vec<u8>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, MySql> for i64

Source§

fn encode_by_ref( &self, buf: &mut Vec<u8>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, MySql> for u8

Source§

fn encode_by_ref( &self, buf: &mut Vec<u8>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, MySql> for u16

Source§

fn encode_by_ref( &self, buf: &mut Vec<u8>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, MySql> for u32

Source§

fn encode_by_ref( &self, buf: &mut Vec<u8>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, MySql> for u64

Source§

fn encode_by_ref( &self, buf: &mut Vec<u8>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut Vec<u8>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut Vec<u8>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, MySql> for String

Source§

fn encode_by_ref( &self, buf: &mut Vec<u8>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut Vec<u8>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, MySql> for Ipv4Addr

Source§

fn encode_by_ref( &self, buf: &mut Vec<u8>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, MySql> for Ipv6Addr

Source§

fn encode_by_ref( &self, buf: &mut Vec<u8>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, Postgres> for &str

Source§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, Postgres> for bool

Source§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, Postgres> for f32

Source§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, Postgres> for f64

Source§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, Postgres> for i8

Source§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, Postgres> for i16

Source§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, Postgres> for i32

Source§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, Postgres> for i64

Source§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, Postgres> for String

Source§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl Encode<'_, Postgres> for Duration

Source§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn size_hint(&self) -> usize

Source§

impl Encode<'_, Postgres> for TimeDelta

Source§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn size_hint(&self) -> usize

Source§

impl Encode<'_, Postgres> for Duration

Source§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn size_hint(&self) -> usize

Source§

impl Encode<'_, Sqlite> for Box<str>

Source§

fn encode( self, args: &mut Vec<SqliteArgumentValue<'_>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'_>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode( self, args: &mut Vec<SqliteArgumentValue<'_>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'_>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'a> Encode<'a, Any> for &'a str

Source§

fn encode( self, buf: &mut <Any as Database>::ArgumentBuffer<'a>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
where &'a str: Sized,

Source§

fn encode_by_ref( &self, buf: &mut <Any as Database>::ArgumentBuffer<'a>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn size_hint(&self) -> usize

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut <Any as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut <Any as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut AnyArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut <Any as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut <Any as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut <Any as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut <Any as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut <Any as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut <Any as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode( self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode( self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode( self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode_by_ref( &self, args: &mut Vec<SqliteArgumentValue<'q>>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

impl<'q, DB> Encode<'q, DB> for NonZero<i8>
where DB: Database, i8: Encode<'q, DB>,

Source§

fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
where NonZero<i8>: Sized,

Source§

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

Source§

impl<'q, DB> Encode<'q, DB> for NonZero<i16>
where DB: Database, i16: Encode<'q, DB>,

Source§

fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
where NonZero<i16>: Sized,

Source§

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

Source§

impl<'q, DB> Encode<'q, DB> for NonZero<i32>
where DB: Database, i32: Encode<'q, DB>,

Source§

fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
where NonZero<i32>: Sized,

Source§

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

Source§

impl<'q, DB> Encode<'q, DB> for NonZero<i64>
where DB: Database, i64: Encode<'q, DB>,

Source§

fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
where NonZero<i64>: Sized,

Source§

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

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
where NonZero<u8>: Sized,

Source§

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

Source§

impl<'q, DB> Encode<'q, DB> for NonZero<u16>
where DB: Database, u16: Encode<'q, DB>,

Source§

fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
where NonZero<u16>: Sized,

Source§

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

Source§

impl<'q, DB> Encode<'q, DB> for NonZero<u32>
where DB: Database, u32: Encode<'q, DB>,

Source§

fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
where NonZero<u32>: Sized,

Source§

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

Source§

impl<'q, DB> Encode<'q, DB> for NonZero<u64>
where DB: Database, u64: Encode<'q, DB>,

Source§

fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
where NonZero<u64>: Sized,

Source§

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

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut AnyArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

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

Source§

fn encode( self, buf: &mut <MySql as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode_by_ref( &self, buf: &mut <MySql as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn size_hint(&self) -> usize

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

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

Source§

fn encode( self, buf: &mut <Postgres as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode_by_ref( &self, buf: &mut <Postgres as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn size_hint(&self) -> usize

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

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

Source§

fn encode( self, buf: &mut <Sqlite as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode_by_ref( &self, buf: &mut <Sqlite as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn size_hint(&self) -> usize

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 Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

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§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Source§

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

Source§

fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>

Implementors§

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<'_, MySql> for Simple

Source§

impl Encode<'_, Postgres> for IpNetwork

Source§

impl Encode<'_, Postgres> for Oid

Source§

impl Encode<'_, Postgres> for PgCiText

Source§

impl Encode<'_, Postgres> for PgHstore

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

§Note: BigDecimal Has a Larger Range than NUMERIC

BigDecimal can represent values with a far, far greater range than the NUMERIC type in Postgres can.

NUMERIC is limited to 131,072 digits before the decimal point, and 16,384 digits after it. See Section 8.1, Numeric Types of the Postgres manual for details.

Meanwhile, BigDecimal can theoretically represent a value with an arbitrary number of decimal digits, albeit with a maximum of 263 significant figures.

Because encoding in the current API design must be infallible, when attempting to encode a BigDecimal that cannot fit in the wire representation of NUMERIC, SQLx may instead encode a sentinel value that falls outside the allowed range but is still representable.

This will cause the query to return a DatabaseError with code 22P03 (invalid_binary_representation) and the error message invalid scale in external "numeric" value (though this may be subject to change).

However, BigDecimal should be able to decode any NUMERIC value except NaN, for which it has no representation.

Source§

impl Encode<'_, Postgres> for BitVec

Source§

impl Encode<'_, Postgres> for Decimal

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 Date

Source§

impl Encode<'_, Sqlite> for OffsetDateTime

Source§

impl Encode<'_, Sqlite> for PrimitiveDateTime

Source§

impl Encode<'_, Sqlite> for Time

Source§

impl<'q> Encode<'q, MySql> for MySqlTime

Source§

impl<'q> Encode<'q, Postgres> for PgCube

Source§

impl<'q> Encode<'q, Postgres> for PgLine

Source§

impl<'q> Encode<'q, Postgres> for PgPoint

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

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<'q, T> Encode<'q, Sqlite> for Text<T>
where T: Display,

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,