Add i16 support for Any Type. (#1895)

* Add i16 support for Any Type.

* fix test.
This commit is contained in:
Chengxing Yuan 2022-06-09 07:01:55 +08:00 committed by GitHub
parent 185c57d936
commit edaf7d0673
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -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);

View File

@ -1037,7 +1037,7 @@ CREATE TABLE heating_bills (
&self,
buf: &mut sqlx::postgres::PgArgumentBuffer,
) -> sqlx::encode::IsNull {
self.0.encode(buf)
<i16 as sqlx::Encode<Postgres>>::encode(self.0, buf)
}
}