mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-19 08:39:44 +00:00
Support PgHstore by default in macros (#3514)
* Support PgHstore in macros * Change tests * Remove unused import
This commit is contained in:
@@ -83,6 +83,7 @@ impl_type_checking!(
|
||||
#[cfg(feature = "bit-vec")]
|
||||
sqlx::types::BitVec,
|
||||
|
||||
sqlx::postgres::types::PgHstore,
|
||||
// Arrays
|
||||
|
||||
Vec<bool> | &[bool],
|
||||
@@ -139,6 +140,8 @@ impl_type_checking!(
|
||||
#[cfg(feature = "json")]
|
||||
Vec<sqlx::types::JsonValue> | &[sqlx::types::JsonValue],
|
||||
|
||||
Vec<sqlx::postgres::types::PgHstore> | &[sqlx::postgres::types::PgHstore],
|
||||
|
||||
// Ranges
|
||||
|
||||
sqlx::postgres::types::PgRange<i32>,
|
||||
|
||||
@@ -10,7 +10,7 @@ use crate::{
|
||||
encode::{Encode, IsNull},
|
||||
error::BoxDynError,
|
||||
types::Type,
|
||||
PgArgumentBuffer, PgTypeInfo, PgValueRef, Postgres,
|
||||
PgArgumentBuffer, PgHasArrayType, PgTypeInfo, PgValueRef, Postgres,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx_core::bytes::Buf;
|
||||
@@ -138,6 +138,12 @@ impl Type<Postgres> for PgHstore {
|
||||
}
|
||||
}
|
||||
|
||||
impl PgHasArrayType for PgHstore {
|
||||
fn array_type_info() -> PgTypeInfo {
|
||||
PgTypeInfo::array_of("hstore")
|
||||
}
|
||||
}
|
||||
|
||||
impl<'r> Decode<'r, Postgres> for PgHstore {
|
||||
fn decode(value: PgValueRef<'r>) -> Result<Self, BoxDynError> {
|
||||
let mut buf = <&[u8] as Decode<Postgres>>::decode(value)?;
|
||||
|
||||
Reference in New Issue
Block a user