Fix #690, add columns query arg for RPC/POST/PATCH
* Refactor normalizing json CTE * Refactor CTE to use CASE instead of UNION
This commit is contained in:
committed by
Steve Chávez
parent
3946dfbc64
commit
c9b2830e52
@@ -13,6 +13,7 @@ import Data.Functor (($>))
|
||||
import qualified Data.HashMap.Strict as M
|
||||
import Data.Text (intercalate, replace, strip)
|
||||
import Data.List (init, last)
|
||||
import qualified Data.Set as S
|
||||
import Data.Tree
|
||||
import Data.Either.Combinators (mapLeft)
|
||||
import PostgREST.RangeQuery (NonnegRange)
|
||||
@@ -217,6 +218,13 @@ pLogicPath = do
|
||||
notOp = "not." <> op
|
||||
return (filter (/= "not") (init path), if "not" `elem` path then notOp else op)
|
||||
|
||||
pRequestColumns :: Text -> Either ParseError (S.Set FieldName)
|
||||
pRequestColumns colStr =
|
||||
S.fromList <$> parse pColumns ("failed to parse columns parameter (" <> toS colStr <> ")") (toS colStr)
|
||||
|
||||
pColumns :: Parser [FieldName]
|
||||
pColumns = pFieldName `sepBy1` lexeme (char ',')
|
||||
|
||||
mapError :: Either ParseError a -> Either ApiRequestError a
|
||||
mapError = mapLeft translateError
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user