mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-02 23:35:20 +00:00
make inet and cidr compatible
This commit is contained in:
parent
c9cca27e65
commit
7ab76ba84e
@ -142,8 +142,16 @@ impl Display for PgTypeInfo {
|
|||||||
|
|
||||||
impl TypeInfo for PgTypeInfo {
|
impl TypeInfo for PgTypeInfo {
|
||||||
fn compatible(&self, other: &Self) -> bool {
|
fn compatible(&self, other: &Self) -> bool {
|
||||||
// TODO: 99% of postgres types are direct equality for [compatible]; when we add something that isn't (e.g, JSON/JSONB), fix this here
|
match (self.id, other.id) {
|
||||||
self.id.0 == other.id.0
|
(TypeId::CIDR, TypeId::INET)
|
||||||
|
| (TypeId::INET, TypeId::CIDR)
|
||||||
|
| (TypeId::ARRAY_CIDR, TypeId::ARRAY_INET)
|
||||||
|
| (TypeId::ARRAY_INET, TypeId::ARRAY_CIDR) => true,
|
||||||
|
_ => {
|
||||||
|
// TODO: 99% of postgres types are direct equality for [compatible]; when we add something that isn't (e.g, JSON/JSONB), fix this here
|
||||||
|
self.id.0 == other.id.0
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user