Skip to content

Commit

Permalink
support hstore polymorphism?
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Feb 14, 2024
1 parent 12c15be commit 2f86e4c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions flow/model/qvalue/qvalue.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"time"

"cloud.google.com/go/civil"
hstore_util "github.com/PeerDB-io/peer-flow/hstore"

Check failure on line 14 in flow/model/qvalue/qvalue.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard -s prefix(github.com/PeerDB-io) -s default (gci)
"github.com/google/uuid"
"github.com/jackc/pgx/v5/pgtype"
geom "github.com/twpayne/go-geos"

Check failure on line 17 in flow/model/qvalue/qvalue.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard -s prefix(github.com/PeerDB-io) -s default (gci)
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 2f86e4c

Please sign in to comment.