From edaf7d06739844c30f2aba762344e6720e5f3f08 Mon Sep 17 00:00:00 2001 From: Chengxing Yuan Date: Thu, 9 Jun 2022 07:01:55 +0800 Subject: [PATCH] Add i16 support for `Any` Type. (#1895) * Add i16 support for Any Type. * fix test. --- sqlx-core/src/any/types.rs | 4 ++++ tests/postgres/postgres.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sqlx-core/src/any/types.rs b/sqlx-core/src/any/types.rs index cf57119766..ace9e2bd4d 100644 --- a/sqlx-core/src/any/types.rs +++ b/sqlx-core/src/any/types.rs @@ -5,6 +5,7 @@ //! | Rust type | SQL type(s) | //! |---------------------------------------|------------------------------------------------------| //! | `bool` | BOOLEAN | +//! | `i16` | SMALLINT | //! | `i32` | INT | //! | `i64` | BIGINT | //! | `f32` | FLOAT | @@ -21,6 +22,7 @@ impl_any_type!(bool); +impl_any_type!(i16); impl_any_type!(i32); impl_any_type!(i64); @@ -34,6 +36,7 @@ impl_any_type!(String); impl_any_encode!(bool); +impl_any_encode!(i16); impl_any_encode!(i32); impl_any_encode!(i64); @@ -47,6 +50,7 @@ impl_any_encode!(String); impl_any_decode!(bool); +impl_any_decode!(i16); impl_any_decode!(i32); impl_any_decode!(i64); diff --git a/tests/postgres/postgres.rs b/tests/postgres/postgres.rs index f3d83d9b73..3f30070c8f 100644 --- a/tests/postgres/postgres.rs +++ b/tests/postgres/postgres.rs @@ -1037,7 +1037,7 @@ CREATE TABLE heating_bills ( &self, buf: &mut sqlx::postgres::PgArgumentBuffer, ) -> sqlx::encode::IsNull { - self.0.encode(buf) + >::encode(self.0, buf) } }