Skip to main content

ToSql

Trait ToSql 

Source
pub trait ToSql: Send + Sync {
    // Required methods
    fn encode(&self, buf: &mut BytesMut) -> Result<IsNull, Error>;
    fn oid(&self) -> Oid;
}
Expand description

A value that can be bound as a query parameter in the binary format.

This trait is object-safe, so &[&dyn ToSql] is the parameter list the macros build. See StaticType for the compile-time type OID.

Required Methods§

Source

fn encode(&self, buf: &mut BytesMut) -> Result<IsNull, Error>

Appends the binary representation of this value to buf, without a length prefix.

Source

fn oid(&self) -> Oid

The PostgreSQL type OID of this value.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ToSql for DateTime

Source§

fn encode(&self, buf: &mut BytesMut) -> Result<IsNull, Error>

Source§

fn oid(&self) -> Oid

Source§

impl ToSql for IpNetwork

Source§

fn encode(&self, buf: &mut BytesMut) -> Result<IsNull, Error>

Source§

fn oid(&self) -> Oid

Source§

impl ToSql for String

Source§

fn encode(&self, buf: &mut BytesMut) -> Result<IsNull, Error>

Source§

fn oid(&self) -> Oid

Source§

impl ToSql for Uuid

Source§

fn encode(&self, buf: &mut BytesMut) -> Result<IsNull, Error>

Source§

fn oid(&self) -> Oid

Source§

impl ToSql for Value

Source§

fn encode(&self, buf: &mut BytesMut) -> Result<IsNull, Error>

Source§

fn oid(&self) -> Oid

Source§

impl ToSql for Vec<u8>

Source§

fn encode(&self, buf: &mut BytesMut) -> Result<IsNull, Error>

Source§

fn oid(&self) -> Oid

Source§

impl ToSql for [u8]

Source§

fn encode(&self, buf: &mut BytesMut) -> Result<IsNull, Error>

Source§

fn oid(&self) -> Oid

Source§

impl ToSql for bool

Source§

fn encode(&self, buf: &mut BytesMut) -> Result<IsNull, Error>

Source§

fn oid(&self) -> Oid

Source§

impl ToSql for f32

Source§

fn encode(&self, buf: &mut BytesMut) -> Result<IsNull, Error>

Source§

fn oid(&self) -> Oid

Source§

impl ToSql for f64

Source§

fn encode(&self, buf: &mut BytesMut) -> Result<IsNull, Error>

Source§

fn oid(&self) -> Oid

Source§

impl ToSql for i16

Source§

fn encode(&self, buf: &mut BytesMut) -> Result<IsNull, Error>

Source§

fn oid(&self) -> Oid

Source§

impl ToSql for i32

Source§

fn encode(&self, buf: &mut BytesMut) -> Result<IsNull, Error>

Source§

fn oid(&self) -> Oid

Source§

impl ToSql for i64

Source§

fn encode(&self, buf: &mut BytesMut) -> Result<IsNull, Error>

Source§

fn oid(&self) -> Oid

Source§

impl ToSql for str

Source§

fn encode(&self, buf: &mut BytesMut) -> Result<IsNull, Error>

Source§

fn oid(&self) -> Oid

Source§

impl<T: ToSql + StaticType + ?Sized> ToSql for &T

Source§

fn encode(&self, buf: &mut BytesMut) -> Result<IsNull, Error>

Source§

fn oid(&self) -> Oid

Source§

impl<T: ToSql + StaticType> ToSql for Option<T>

Source§

fn encode(&self, buf: &mut BytesMut) -> Result<IsNull, Error>

Source§

fn oid(&self) -> Oid

Source§

impl<T: ToSql + StaticType> ToSql for Vec<T>

Source§

fn encode(&self, buf: &mut BytesMut) -> Result<IsNull, Error>

Source§

fn oid(&self) -> Oid

Source§

impl<T: ToSql + StaticType> ToSql for [T]

Source§

fn encode(&self, buf: &mut BytesMut) -> Result<IsNull, Error>

Source§

fn oid(&self) -> Oid

Implementors§

Source§

impl ToSql for Date

Source§

impl ToSql for Interval

Source§

impl ToSql for Timestamp

Source§

impl<I, T> ToSql for Array<I>
where I: Iterator<Item = T> + Send, T: ToSql + StaticType,

Source§

impl<T: Serialize + Send + Sync> ToSql for Json<T>