Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better support for Postgres Arrays #1767

Closed
wants to merge 10 commits into from
Prev Previous commit
Next Next commit
Change _contained_in to _is_contained_by
  • Loading branch information
nizar-m committed Mar 20, 2019
commit cfc69c48235a9633becee566e4afb27a3782ea14
2 changes: 1 addition & 1 deletion server/src-lib/Hasura/GraphQL/Context.hs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ mkCompExpInp colTy@(PGColType _ _ _ colDtls) =
]

arrOps =
[ "_contains", "_contained_in"]
[ "_contains", "_is_contained_by"]

isJsonbTy = case bTy of
Just PGJSONB -> True
Expand Down
11 changes: 6 additions & 5 deletions server/src-lib/Hasura/GraphQL/Resolve/BoolExp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ parseOpExps annVal = do
"_nsimilar" -> fmap ANSIMILAR <$> asPGColValM v

-- jsonb related operators
"_contains" -> fmap AContains <$> asPGColValM v
"_contained_in" -> fmap AContainedIn <$> asPGColValM v
"_has_key" -> fmap AHasKey <$> asPGColValM v
"_has_keys_any" -> fmap AHasKeysAny <$> parseMany asPGColText v
"_has_keys_all" -> fmap AHasKeysAll <$> parseMany asPGColText v
"_contains" -> fmap AContains <$> asPGColValM v
"_contained_in" -> fmap AContainedIn <$> asPGColValM v
"_is_contained_by" -> fmap AContainedIn <$> asPGColValM v
"_has_key" -> fmap AHasKey <$> asPGColValM v
"_has_keys_any" -> fmap AHasKeysAny <$> parseMany asPGColText v
"_has_keys_all" -> fmap AHasKeysAll <$> parseMany asPGColText v

-- geometry type related operators
"_st_contains" -> fmap ASTContains <$> asPGColValM v
Expand Down
11 changes: 7 additions & 4 deletions server/src-lib/Hasura/RQL/GBoolExp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,13 @@ parseOpExp parser fim (PGColInfo cn colTy _) (opStr, val) = withErrPath $
"_is_null" -> parseIsNull

-- jsonb type
"_contains" -> jsonbOrArrOp $ AContains <$> parseOne
"$contains" -> jsonbOrArrOp $ AContains <$> parseOne
"_contained_in" -> jsonbOrArrOp $ AContainedIn <$> parseOne
"$contained_in" -> jsonbOrArrOp $ AContainedIn <$> parseOne
"_contains" -> jsonbOrArrOp $ AContains <$> parseOne
"$contains" -> jsonbOrArrOp $ AContains <$> parseOne
"_contained_in" -> jsonbOrArrOp $ AContainedIn <$> parseOne
"$contained_in" -> jsonbOnlyOp $ AContainedIn <$> parseOne
"$is_contained_by" -> jsonbOrArrOp $ AContainedIn <$> parseOne
"_is_contained_by" -> jsonbOrArrOp $ AContainedIn <$> parseOne

"_has_key" -> jsonbOnlyOp $ AHasKey <$> parseWithTy (baseTy PGText)
"$has_key" -> jsonbOnlyOp $ AHasKey <$> parseWithTy (baseTy PGText)

Expand Down