@@ -192,6 +192,7 @@ wherePred table (col, predicate) =
|
|||||||
"like" -> unknownLiteral $ T.map star value
|
"like" -> unknownLiteral $ T.map star value
|
||||||
"ilike" -> unknownLiteral $ T.map star value
|
"ilike" -> unknownLiteral $ T.map star value
|
||||||
"in" -> "(" <> T.intercalate ", " (map unknownLiteral $ T.split (==',') value) <> ") "
|
"in" -> "(" <> T.intercalate ", " (map unknownLiteral $ T.split (==',') value) <> ") "
|
||||||
|
"notin" -> "(" <> T.intercalate ", " (map unknownLiteral $ T.split (==',') value) <> ") "
|
||||||
"@@" -> "to_tsquery(" <> unknownLiteral value <> ") "
|
"@@" -> "to_tsquery(" <> unknownLiteral value <> ") "
|
||||||
_ -> unknownLiteral value
|
_ -> unknownLiteral value
|
||||||
|
|
||||||
@@ -205,6 +206,7 @@ wherePred table (col, predicate) =
|
|||||||
"like"-> "like"
|
"like"-> "like"
|
||||||
"ilike"-> "ilike"
|
"ilike"-> "ilike"
|
||||||
"in" -> "in"
|
"in" -> "in"
|
||||||
|
"notin" -> "not in"
|
||||||
"is" -> "is"
|
"is" -> "is"
|
||||||
"isnot" -> "is not"
|
"isnot" -> "is not"
|
||||||
"@@" -> "@@"
|
"@@" -> "@@"
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ spec = afterAll_ resetDb $ around withApp $ do
|
|||||||
it "fails with 400 and error" $
|
it "fails with 400 and error" $
|
||||||
post "/simple_pk" "}{ x = 2"
|
post "/simple_pk" "}{ x = 2"
|
||||||
`shouldRespondWith` ResponseMatcher {
|
`shouldRespondWith` ResponseMatcher {
|
||||||
matchBody = Just [json| {"message":"Failed to parse JSON payload. Failed reading: satisfy"} |]
|
matchBody = Just [json| {"message":"Failed to parse JSON payload. Failed reading: not a valid json value"} |]
|
||||||
, matchStatus = 400
|
, matchStatus = 400
|
||||||
, matchHeaders = []
|
, matchHeaders = []
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,14 @@ spec =
|
|||||||
, matchHeaders = ["Content-Range" <:> "0-2/3"]
|
, matchHeaders = ["Content-Range" <:> "0-2/3"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
it "matches items NOT IN" $
|
||||||
|
get "/items?id=notin.2,4,6,7,8,9,10,11,12,13,14,15"
|
||||||
|
`shouldRespondWith` ResponseMatcher {
|
||||||
|
matchBody = Just [json| [{"id":1},{"id":3},{"id":5}] |]
|
||||||
|
, matchStatus = 200
|
||||||
|
, matchHeaders = ["Content-Range" <:> "0-2/3"]
|
||||||
|
}
|
||||||
|
|
||||||
it "matches nulls in varchar and numeric fields alike" $ do
|
it "matches nulls in varchar and numeric fields alike" $ do
|
||||||
get "/no_pk?a=is.null" `shouldRespondWith`
|
get "/no_pk?a=is.null" `shouldRespondWith`
|
||||||
[json| [{"a": null, "b": null}] |]
|
[json| [{"a": null, "b": null}] |]
|
||||||
|
|||||||
Reference in New Issue
Block a user