Skip to content

Commit

Permalink
support jsonb
Browse files Browse the repository at this point in the history
  • Loading branch information
Amogh-Bharadwaj committed May 7, 2024
1 parent 06297c9 commit 9a464d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions flow/connectors/postgres/qvalue_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ func (c *PostgresConnector) postgresOIDToQValueKind(recvOID uint32) qvalue.QValu
return qvalue.QValueKindString
case pgtype.ByteaOID:
return qvalue.QValueKindBytes
case pgtype.JSONOID, pgtype.JSONBOID:
case pgtype.JSONOID:
return qvalue.QValueKindJSON
case pgtype.JSONBOID:
return qvalue.QValueKindJSONB
case pgtype.UUIDOID:
return qvalue.QValueKindUUID
case pgtype.TimeOID:
Expand Down Expand Up @@ -165,6 +167,8 @@ func qValueKindToPostgresType(colTypeStr string) string {
return "BYTEA"
case qvalue.QValueKindJSON:
return "JSON"
case qvalue.QValueKindJSONB:
return "JSONB"
case qvalue.QValueKindHStore:
return "HSTORE"
case qvalue.QValueKindUUID:
Expand Down Expand Up @@ -325,7 +329,7 @@ func parseFieldFromQValueKind(qvalueKind qvalue.QValueKind, value interface{}) (
case qvalue.QValueKindBoolean:
boolVal := value.(bool)
return qvalue.QValueBoolean{Val: boolVal}, nil
case qvalue.QValueKindJSON:
case qvalue.QValueKindJSON, qvalue.QValueKindJSONB:
tmp, err := parseJSON(value)
if err != nil {
return nil, fmt.Errorf("failed to parse JSON: %w", err)
Expand Down
1 change: 1 addition & 0 deletions flow/model/qvalue/kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const (
QValueKindBytes QValueKind = "bytes"
QValueKindUUID QValueKind = "uuid"
QValueKindJSON QValueKind = "json"
QValueKindJSONB QValueKind = "jsonb"
QValueKindBit QValueKind = "bit"
QValueKindHStore QValueKind = "hstore"
QValueKindGeography QValueKind = "geography"
Expand Down

0 comments on commit 9a464d6

Please sign in to comment.