Note which rpc params are optional

This commit is contained in:
Joe Nelson
2016-09-11 15:15:38 -07:00
parent 466090c79b
commit 25c2cd1f2d
3 changed files with 22 additions and 17 deletions
+6 -5
View File
@@ -105,14 +105,15 @@ accessibleProcs =
addName :: ProcDescription -> (Text, ProcDescription)
addName pd = (pdName pd, pd)
parseArgs :: Text -> [(PgArgName, PgArgType)]
parseArgs = mapMaybe list2pair
parseArgs :: Text -> [PgArg]
parseArgs = mapMaybe toks2arg
. map (split (==' ') . strip)
. split (==',')
list2pair :: [a] -> Maybe (a,a)
list2pair (x:y:_) = Just (x,y)
list2pair _ = Nothing
toks2arg :: [Text] -> Maybe PgArg
toks2arg (x:y:"DEFAULT":_) = Just (PgArg x y False)
toks2arg (x:y:_) = Just (PgArg x y True)
toks2arg _ = Nothing
sql = [q|
SELECT p.proname as "proc_name",