@@ -19,6 +19,12 @@ impl Type<Postgres> for str {
1919 PgTypeInfo :: BPCHAR ,
2020 PgTypeInfo :: VARCHAR ,
2121 PgTypeInfo :: INTERVAL ,
22+ PgTypeInfo :: INT4_RANGE ,
23+ PgTypeInfo :: NUM_RANGE ,
24+ PgTypeInfo :: TS_RANGE ,
25+ PgTypeInfo :: TSTZ_RANGE ,
26+ PgTypeInfo :: DATE_RANGE ,
27+ PgTypeInfo :: INT8_RANGE ,
2228 PgTypeInfo :: MONEY ,
2329 PgTypeInfo :: UNKNOWN ,
2430 ]
@@ -115,6 +121,18 @@ impl Decode<'_, Postgres> for String {
115121 fn decode ( value : PgValueRef < ' _ > ) -> Result < Self , BoxDynError > {
116122 match * value. type_info {
117123 PgType :: Interval => super :: interval:: decode_as_string ( value) ,
124+ PgType :: Int4Range => super :: range:: decode_as_string :: < i32 > ( value) ,
125+ #[ cfg( feature = "bigdecimal" ) ]
126+ PgType :: NumRange => super :: range:: decode_as_string :: < bigdecimal:: BigDecimal > ( value) ,
127+ #[ cfg( feature = "chrono" ) ]
128+ PgType :: TsRange => super :: range:: decode_as_string :: < chrono:: NaiveDateTime > ( value) ,
129+ #[ cfg( feature = "chrono" ) ]
130+ PgType :: TstzRange => {
131+ super :: range:: decode_as_string :: < chrono:: DateTime < chrono:: Utc > > ( value)
132+ }
133+ #[ cfg( feature = "chrono" ) ]
134+ PgType :: DateRange => super :: range:: decode_as_string :: < chrono:: NaiveDate > ( value) ,
135+ PgType :: Int8Range => super :: range:: decode_as_string :: < i64 > ( value) ,
118136 _ => Ok ( value. as_str ( ) ?. to_owned ( ) ) ,
119137 }
120138 }
0 commit comments