Skip to content

Commit

Permalink
fix hstore code
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Feb 14, 2024
1 parent a4aa925 commit 00c3d47
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions flow/model/qvalue/qvalue.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,17 +268,23 @@ 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 {
parsedHStore1 = string(bytes)
} else {
parsedHStore1, err = hstore_util.ParseHstore(value1.(string))
str2 := value2.(string)
switch v1 := value1.(type) {
case pgtype.Hstore:
bytes, err := json.Marshal(v1)
if err != nil {
panic(err)
}
return string(bytes) == str2
case string:
parsedHStore1, err := hstore_util.ParseHstore(v1)
if err != nil {
panic(err)
}
return parsedHStore1 == str2
default:
panic(fmt.Sprintf("invalid hstore value type %T: %v", value1, value1))
}
return parsedHStore1 == value2.(string)
}

func compareGeometry(value1, value2 interface{}) bool {
Expand Down

0 comments on commit 00c3d47

Please sign in to comment.