Skip to content

Commit

Permalink
Add i16 support for Any Type. (#1895)
Browse files Browse the repository at this point in the history
* Add i16 support for Any Type.

* fix test.
  • Loading branch information
EthanYuan committed Jun 8, 2022
1 parent 185c57d commit edaf7d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions sqlx-core/src/any/types.rs
Expand Up @@ -5,6 +5,7 @@
//! | Rust type | SQL type(s) |
//! |---------------------------------------|------------------------------------------------------|
//! | `bool` | BOOLEAN |
//! | `i16` | SMALLINT |
//! | `i32` | INT |
//! | `i64` | BIGINT |
//! | `f32` | FLOAT |
Expand All @@ -21,6 +22,7 @@

impl_any_type!(bool);

impl_any_type!(i16);
impl_any_type!(i32);
impl_any_type!(i64);

Expand All @@ -34,6 +36,7 @@ impl_any_type!(String);

impl_any_encode!(bool);

impl_any_encode!(i16);
impl_any_encode!(i32);
impl_any_encode!(i64);

Expand All @@ -47,6 +50,7 @@ impl_any_encode!(String);

impl_any_decode!(bool);

impl_any_decode!(i16);
impl_any_decode!(i32);
impl_any_decode!(i64);

Expand Down
2 changes: 1 addition & 1 deletion tests/postgres/postgres.rs
Expand Up @@ -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)
}
}

Expand Down

0 comments on commit edaf7d0

Please sign in to comment.