From 2f86e4cf80e3c2f4674dad96741a312bc9ee5843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Wed, 14 Feb 2024 17:18:09 +0000 Subject: [PATCH] support hstore polymorphism? --- flow/model/qvalue/qvalue.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/flow/model/qvalue/qvalue.go b/flow/model/qvalue/qvalue.go index 761b9e33b0..c36ac3a2f0 100644 --- a/flow/model/qvalue/qvalue.go +++ b/flow/model/qvalue/qvalue.go @@ -11,6 +11,7 @@ import ( "time" "cloud.google.com/go/civil" + hstore_util "github.com/PeerDB-io/peer-flow/hstore" "github.com/google/uuid" "github.com/jackc/pgx/v5/pgtype" geom "github.com/twpayne/go-geos" @@ -264,11 +265,17 @@ func compareString(value1, value2 interface{}) bool { } func compareHstore(value1, value2 interface{}) bool { + var parsedHStore1 string bytes, err := json.Marshal(value1.(pgtype.Hstore)) if err != nil { - panic(err) + parsedHStore1 = string(bytes) + } else { + parsedHStore1, err = hstore_util.ParseHstore(value1.(string)) + if err != nil { + panic(err) + } } - return string(bytes) == value2.(string) + return parsedHStore1 == value2.(string) } func compareGeometry(value1, value2 interface{}) bool {