Skip to content

Commit

Permalink
feat: add support for JSONB operators in List hydrate functions (#584)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdecat authored Jul 5, 2023
1 parent c81a226 commit f3ceed5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
10 changes: 9 additions & 1 deletion plugin/key_column.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ func GetValidOperators() []string {
quals.QualOperatorNotIRegex,
quals.QualOperatorIsNull,
quals.QualOperatorIsNotNull,

quals.QualOperatorJsonbContainsLeftRight,
quals.QualOperatorJsonbContainsRightLeft,
quals.QualOperatorJsonbExistsOne,
quals.QualOperatorJsonbExistsAny,
quals.QualOperatorJsonbExistsAll,
quals.QualOperatorJsonbPathExists,
quals.QualOperatorJsonbPathPredicate,
}
}

Expand All @@ -46,7 +54,7 @@ func GetValidOperators() []string {
//
// # Operators
//
// This property specifies the accepted operators (from a possible set: "=", "<>", "<", "<=", ">", ">=", "~~", "!~~", "~~*", "!~~*", "~", "~*", "!~", "!~*")
// This property specifies the accepted operators (from a possible set: "=", "<>", "<", "<=", ">", ">=", "~~", "!~~", "~~*", "!~~*", "~", "~*", "!~", "!~*", "@>", "<@", "?", "?|", "?&", "@?", "@@")
//
// # Require
//
Expand Down
8 changes: 8 additions & 0 deletions plugin/quals/qual.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ const (
QualOperatorNotIRegex = "!~*"
QualOperatorIsNull = "is null"
QualOperatorIsNotNull = "is not null"

QualOperatorJsonbContainsLeftRight = "@>"
QualOperatorJsonbContainsRightLeft = "<@"
QualOperatorJsonbExistsOne = "?"
QualOperatorJsonbExistsAny = "?|"
QualOperatorJsonbExistsAll = "?&"
QualOperatorJsonbPathExists = "@?"
QualOperatorJsonbPathPredicate = "@@" // FIXME: I'm a little confused about this one
)

// Qual is a struct which represents a database qual in a more easily digestible form that proto.Qual
Expand Down

0 comments on commit f3ceed5

Please sign in to comment.