Skip to main content

ToSql

Trait ToSql 

Source
pub trait ToSql {
    // Required method
    fn to_sql(&self) -> PgValue;

    // Provided method
    fn type_oid(&self) -> u32 { ... }
}
Expand description

Trait for converting Rust types to PostgreSQL parameter values. Replaces the older ToParam — provides the same functionality with a more standard name and the ability to specify the OID.

Required Methods§

Source

fn to_sql(&self) -> PgValue

Convert this value to a PgValue for use as a query parameter.

Provided Methods§

Source

fn type_oid(&self) -> u32

The PostgreSQL type OID this value maps to (0 = let the server decide).

Implementations on Foreign Types§

Source§

impl ToSql for &str

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for &[bool]

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for &[f32]

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for &[f64]

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for &[i16]

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for &[i32]

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for &[i64]

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for &[u8]

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for (f64, f64)

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for IpAddr

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for bool

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for f32

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for f64

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for i16

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for i32

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for i64

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for String

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for Vec<bool>

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for Vec<f32>

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for Vec<f64>

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for Vec<i16>

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for Vec<i32>

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for Vec<i64>

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for Vec<u8>

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for Vec<String>

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for Ipv4Addr

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for Ipv6Addr

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl ToSql for [u8; 6]

Source§

fn to_sql(&self) -> PgValue

Source§

fn type_oid(&self) -> u32

Source§

impl<T> ToSql for Option<T>
where T: ToSql,

Source§

fn to_sql(&self) -> PgValue

Implementors§