[][src]Trait diesel::serialize::WriteTuple

pub trait WriteTuple<ST> {
    fn write_tuple<W: Write>(&self, out: &mut Output<W, Pg>) -> Result;
}

Helper trait for writing tuples as named composite types

This trait is essentially ToSql<Record<ST>> for tuples. While we can provide a valid body of to_sql, PostgreSQL doesn't allow the use of bind parameters for unnamed composite types. For this reason, we avoid implementing ToSql directly.

This trait can be used by ToSql impls of named composite types.

Example

    #[derive(SqlType)]
    #[postgres(type_name = "my_type")]
    struct MyType;

    #[derive(Debug)]
    struct MyStruct<'a>(i32, &'a str);

    impl<'a> ToSql<MyType, Pg> for MyStruct<'a> {
        fn to_sql<W: Write>(&self, out: &mut Output<W, Pg>) -> serialize::Result {
            WriteTuple::<(Integer, Text)>::write_tuple(
                &(self.0, self.1),
                out,
            )
        }
    }

Required methods

fn write_tuple<W: Write>(&self, out: &mut Output<W, Pg>) -> Result

See trait documentation.

Loading content...

Implementations on Foreign Types

impl<A, SA> WriteTuple<(SA,)> for (A,) where
    A: ToSql<SA, Pg>,
    Pg: HasSqlType<SA>, 
[src]

impl<A, B, SA, SB> WriteTuple<(SA, SB)> for (A, B) where
    A: ToSql<SA, Pg>,
    B: ToSql<SB, Pg>,
    Pg: HasSqlType<SA>,
    Pg: HasSqlType<SB>, 
[src]

impl<A, B, C, SA, SB, SC> WriteTuple<(SA, SB, SC)> for (A, B, C) where
    A: ToSql<SA, Pg>,
    B: ToSql<SB, Pg>,
    C: ToSql<SC, Pg>,
    Pg: HasSqlType<SA>,
    Pg: HasSqlType<SB>,
    Pg: HasSqlType<SC>, 
[src]

impl<A, B, C, D, SA, SB, SC, SD> WriteTuple<(SA, SB, SC, SD)> for (A, B, C, D) where
    A: ToSql<SA, Pg>,
    B: ToSql<SB, Pg>,
    C: ToSql<SC, Pg>,
    D: ToSql<SD, Pg>,
    Pg: HasSqlType<SA>,
    Pg: HasSqlType<SB>,
    Pg: HasSqlType<SC>,
    Pg: HasSqlType<SD>, 
[src]

impl<A, B, C, D, E, SA, SB, SC, SD, SE> WriteTuple<(SA, SB, SC, SD, SE)> for (A, B, C, D, E) where
    A: ToSql<SA, Pg>,
    B: ToSql<SB, Pg>,
    C: ToSql<SC, Pg>,
    D: ToSql<SD, Pg>,
    E: ToSql<SE, Pg>,
    Pg: HasSqlType<SA>,
    Pg: HasSqlType<SB>,
    Pg: HasSqlType<SC>,
    Pg: HasSqlType<SD>,
    Pg: HasSqlType<SE>, 
[src]

impl<A, B, C, D, E, F, SA, SB, SC, SD, SE, SF> WriteTuple<(SA, SB, SC, SD, SE, SF)> for (A, B, C, D, E, F) where
    A: ToSql<SA, Pg>,
    B: ToSql<SB, Pg>,
    C: ToSql<SC, Pg>,
    D: ToSql<SD, Pg>,
    E: ToSql<SE, Pg>,
    F: ToSql<SF, Pg>,
    Pg: HasSqlType<SA>,
    Pg: HasSqlType<SB>,
    Pg: HasSqlType<SC>,
    Pg: HasSqlType<SD>,
    Pg: HasSqlType<SE>,
    Pg: HasSqlType<SF>, 
[src]

impl<A, B, C, D, E, F, G, SA, SB, SC, SD, SE, SF, SG> WriteTuple<(SA, SB, SC, SD, SE, SF, SG)> for (A, B, C, D, E, F, G) where
    A: ToSql<SA, Pg>,
    B: ToSql<SB, Pg>,
    C: ToSql<SC, Pg>,
    D: ToSql<SD, Pg>,
    E: ToSql<SE, Pg>,
    F: ToSql<SF, Pg>,
    G: ToSql<SG, Pg>,
    Pg: HasSqlType<SA>,
    Pg: HasSqlType<SB>,
    Pg: HasSqlType<SC>,
    Pg: HasSqlType<SD>,
    Pg: HasSqlType<SE>,
    Pg: HasSqlType<SF>,
    Pg: HasSqlType<SG>, 
[src]

impl<A, B, C, D, E, F, G, H, SA, SB, SC, SD, SE, SF, SG, SH> WriteTuple<(SA, SB, SC, SD, SE, SF, SG, SH)> for (A, B, C, D, E, F, G, H) where
    A: ToSql<SA, Pg>,
    B: ToSql<SB, Pg>,
    C: ToSql<SC, Pg>,
    D: ToSql<SD, Pg>,
    E: ToSql<SE, Pg>,
    F: ToSql<SF, Pg>,
    G: ToSql<SG, Pg>,
    H: ToSql<SH, Pg>,
    Pg: HasSqlType<SA>,
    Pg: HasSqlType<SB>,
    Pg: HasSqlType<SC>,
    Pg: HasSqlType<SD>,
    Pg: HasSqlType<SE>,
    Pg: HasSqlType<SF>,
    Pg: HasSqlType<SG>,
    Pg: HasSqlType<SH>, 
[src]

impl<A, B, C, D, E, F, G, H, I, SA, SB, SC, SD, SE, SF, SG, SH, SI> WriteTuple<(SA, SB, SC, SD, SE, SF, SG, SH, SI)> for (A, B, C, D, E, F, G, H, I) where
    A: ToSql<SA, Pg>,
    B: ToSql<SB, Pg>,
    C: ToSql<SC, Pg>,
    D: ToSql<SD, Pg>,
    E: ToSql<SE, Pg>,
    F: ToSql<SF, Pg>,
    G: ToSql<SG, Pg>,
    H: ToSql<SH, Pg>,
    I: ToSql<SI, Pg>,
    Pg: HasSqlType<SA>,
    Pg: HasSqlType<SB>,
    Pg: HasSqlType<SC>,
    Pg: HasSqlType<SD>,
    Pg: HasSqlType<SE>,
    Pg: HasSqlType<SF>,
    Pg: HasSqlType<SG>,
    Pg: HasSqlType<SH>,
    Pg: HasSqlType<SI>, 
[src]

impl<A, B, C, D, E, F, G, H, I, J, SA, SB, SC, SD, SE, SF, SG, SH, SI, SJ> WriteTuple<(SA, SB, SC, SD, SE, SF, SG, SH, SI, SJ)> for (A, B, C, D, E, F, G, H, I, J) where
    A: ToSql<SA, Pg>,
    B: ToSql<SB, Pg>,
    C: ToSql<SC, Pg>,
    D: ToSql<SD, Pg>,
    E: ToSql<SE, Pg>,
    F: ToSql<SF, Pg>,
    G: ToSql<SG, Pg>,
    H: ToSql<SH, Pg>,
    I: ToSql<SI, Pg>,
    J: ToSql<SJ, Pg>,
    Pg: HasSqlType<SA>,
    Pg: HasSqlType<SB>,
    Pg: HasSqlType<SC>,
    Pg: HasSqlType<SD>,
    Pg: HasSqlType<SE>,
    Pg: HasSqlType<SF>,
    Pg: HasSqlType<SG>,
    Pg: HasSqlType<SH>,
    Pg: HasSqlType<SI>,
    Pg: HasSqlType<SJ>, 
[src]

impl<A, B, C, D, E, F, G, H, I, J, K, SA, SB, SC, SD, SE, SF, SG, SH, SI, SJ, SK> WriteTuple<(SA, SB, SC, SD, SE, SF, SG, SH, SI, SJ, SK)> for (A, B, C, D, E, F, G, H, I, J, K) where
    A: ToSql<SA, Pg>,
    B: ToSql<SB, Pg>,
    C: ToSql<SC, Pg>,
    D: ToSql<SD, Pg>,
    E: ToSql<SE, Pg>,
    F: ToSql<SF, Pg>,
    G: ToSql<SG, Pg>,
    H: ToSql<SH, Pg>,
    I: ToSql<SI, Pg>,
    J: ToSql<SJ, Pg>,
    K: ToSql<SK, Pg>,
    Pg: HasSqlType<SA>,
    Pg: HasSqlType<SB>,
    Pg: HasSqlType<SC>,
    Pg: HasSqlType<SD>,
    Pg: HasSqlType<SE>,
    Pg: HasSqlType<SF>,
    Pg: HasSqlType<SG>,
    Pg: HasSqlType<SH>,
    Pg: HasSqlType<SI>,
    Pg: HasSqlType<SJ>,
    Pg: HasSqlType<SK>, 
[src]

impl<A, B, C, D, E, F, G, H, I, J, K, L, SA, SB, SC, SD, SE, SF, SG, SH, SI, SJ, SK, SL> WriteTuple<(SA, SB, SC, SD, SE, SF, SG, SH, SI, SJ, SK, SL)> for (A, B, C, D, E, F, G, H, I, J, K, L) where
    A: ToSql<SA, Pg>,
    B: ToSql<SB, Pg>,
    C: ToSql<SC, Pg>,
    D: ToSql<SD, Pg>,
    E: ToSql<SE, Pg>,
    F: ToSql<SF, Pg>,
    G: ToSql<SG, Pg>,
    H: ToSql<SH, Pg>,
    I: ToSql<SI, Pg>,
    J: ToSql<SJ, Pg>,
    K: ToSql<SK, Pg>,
    L: ToSql<SL, Pg>,
    Pg: HasSqlType<SA>,
    Pg: HasSqlType<SB>,
    Pg: HasSqlType<SC>,
    Pg: HasSqlType<SD>,
    Pg: HasSqlType<SE>,
    Pg: HasSqlType<SF>,
    Pg: HasSqlType<SG>,
    Pg: HasSqlType<SH>,
    Pg: HasSqlType<SI>,
    Pg: HasSqlType<SJ>,
    Pg: HasSqlType<SK>,
    Pg: HasSqlType<SL>, 
[src]

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, SA, SB, SC, SD, SE, SF, SG, SH, SI, SJ, SK, SL, SM> WriteTuple<(SA, SB, SC, SD, SE, SF, SG, SH, SI, SJ, SK, SL, SM)> for (A, B, C, D, E, F, G, H, I, J, K, L, M) where
    A: ToSql<SA, Pg>,
    B: ToSql<SB, Pg>,
    C: ToSql<SC, Pg>,
    D: ToSql<SD, Pg>,
    E: ToSql<SE, Pg>,
    F: ToSql<SF, Pg>,
    G: ToSql<SG, Pg>,
    H: ToSql<SH, Pg>,
    I: ToSql<SI, Pg>,
    J: ToSql<SJ, Pg>,
    K: ToSql<SK, Pg>,
    L: ToSql<SL, Pg>,
    M: ToSql<SM, Pg>,
    Pg: HasSqlType<SA>,
    Pg: HasSqlType<SB>,
    Pg: HasSqlType<SC>,
    Pg: HasSqlType<SD>,
    Pg: HasSqlType<SE>,
    Pg: HasSqlType<SF>,
    Pg: HasSqlType<SG>,
    Pg: HasSqlType<SH>,
    Pg: HasSqlType<SI>,
    Pg: HasSqlType<SJ>,
    Pg: HasSqlType<SK>,
    Pg: HasSqlType<SL>,
    Pg: HasSqlType<SM>, 
[src]

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, SA, SB, SC, SD, SE, SF, SG, SH, SI, SJ, SK, SL, SM, SN> WriteTuple<(SA, SB, SC, SD, SE, SF, SG, SH, SI, SJ, SK, SL, SM, SN)> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N) where
    A: ToSql<SA, Pg>,
    B: ToSql<SB, Pg>,
    C: ToSql<SC, Pg>,
    D: ToSql<SD, Pg>,
    E: ToSql<SE, Pg>,
    F: ToSql<SF, Pg>,
    G: ToSql<SG, Pg>,
    H: ToSql<SH, Pg>,
    I: ToSql<SI, Pg>,
    J: ToSql<SJ, Pg>,
    K: ToSql<SK, Pg>,
    L: ToSql<SL, Pg>,
    M: ToSql<SM, Pg>,
    N: ToSql<SN, Pg>,
    Pg: HasSqlType<SA>,
    Pg: HasSqlType<SB>,
    Pg: HasSqlType<SC>,
    Pg: HasSqlType<SD>,
    Pg: HasSqlType<SE>,
    Pg: HasSqlType<SF>,
    Pg: HasSqlType<SG>,
    Pg: HasSqlType<SH>,
    Pg: HasSqlType<SI>,
    Pg: HasSqlType<SJ>,
    Pg: HasSqlType<SK>,
    Pg: HasSqlType<SL>,
    Pg: HasSqlType<SM>,
    Pg: HasSqlType<SN>, 
[src]

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, SA, SB, SC, SD, SE, SF, SG, SH, SI, SJ, SK, SL, SM, SN, SO> WriteTuple<(SA, SB, SC, SD, SE, SF, SG, SH, SI, SJ, SK, SL, SM, SN, SO)> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) where
    A: ToSql<SA, Pg>,
    B: ToSql<SB, Pg>,
    C: ToSql<SC, Pg>,
    D: ToSql<SD, Pg>,
    E: ToSql<SE, Pg>,
    F: ToSql<SF, Pg>,
    G: ToSql<SG, Pg>,
    H: ToSql<SH, Pg>,
    I: ToSql<SI, Pg>,
    J: ToSql<SJ, Pg>,
    K: ToSql<SK, Pg>,
    L: ToSql<SL, Pg>,
    M: ToSql<SM, Pg>,
    N: ToSql<SN, Pg>,
    O: ToSql<SO, Pg>,
    Pg: HasSqlType<SA>,
    Pg: HasSqlType<SB>,
    Pg: HasSqlType<SC>,
    Pg: HasSqlType<SD>,
    Pg: HasSqlType<SE>,
    Pg: HasSqlType<SF>,
    Pg: HasSqlType<SG>,
    Pg: HasSqlType<SH>,
    Pg: HasSqlType<SI>,
    Pg: HasSqlType<SJ>,
    Pg: HasSqlType<SK>,
    Pg: HasSqlType<SL>,
    Pg: HasSqlType<SM>,
    Pg: HasSqlType<SN>,
    Pg: HasSqlType<SO>, 
[src]

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, SA, SB, SC, SD, SE, SF, SG, SH, SI, SJ, SK, SL, SM, SN, SO, SP> WriteTuple<(SA, SB, SC, SD, SE, SF, SG, SH, SI, SJ, SK, SL, SM, SN, SO, SP)> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) where
    A: ToSql<SA, Pg>,
    B: ToSql<SB, Pg>,
    C: ToSql<SC, Pg>,
    D: ToSql<SD, Pg>,
    E: ToSql<SE, Pg>,
    F: ToSql<SF, Pg>,
    G: ToSql<SG, Pg>,
    H: ToSql<SH, Pg>,
    I: ToSql<SI, Pg>,
    J: ToSql<SJ, Pg>,
    K: ToSql<SK, Pg>,
    L: ToSql<SL, Pg>,
    M: ToSql<SM, Pg>,
    N: ToSql<SN, Pg>,
    O: ToSql<SO, Pg>,
    P: ToSql<SP, Pg>,
    Pg: HasSqlType<SA>,
    Pg: HasSqlType<SB>,
    Pg: HasSqlType<SC>,
    Pg: HasSqlType<SD>,
    Pg: HasSqlType<SE>,
    Pg: HasSqlType<SF>,
    Pg: HasSqlType<SG>,
    Pg: HasSqlType<SH>,
    Pg: HasSqlType<SI>,
    Pg: HasSqlType<SJ>,
    Pg: HasSqlType<SK>,
    Pg: HasSqlType<SL>,
    Pg: HasSqlType<SM>,
    Pg: HasSqlType<SN>,
    Pg: HasSqlType<SO>,
    Pg: HasSqlType<SP>, 
[src]

Loading content...

Implementors

Loading content...