Make complete match agains ClaimsMap in setVar

This commit is contained in:
Diogo Biazus
2015-10-17 20:41:42 -04:00
parent 31f1a30d6f
commit aae55e0282
+6 -1
View File
@@ -57,7 +57,12 @@ setDBEnv maybeClaims =
(map setVar . toList) <$> maybeClaims
where
setVar ("role", String val) = setRole val
setVar (key, String val) = "set local postgrest.claims" <> key <> " = " <> cs (pgFmtLit val) <> ";"
setVar (key, String val) = "set local postgrest.claims" <> key <> " = " <> pgFmtLit val <> ";"
setVar (key, Bool val) = "set local postgrest.claims" <> key <> " = " <> showText val <> ";"
setVar (key, Number val) = "set local postgrest.claims" <> key <> " = " <> showText val <> ";"
setVar _ = ""
showText :: Show a => a -> Text
showText = cs . show
setRole :: Text -> Text
setRole role = "set local role " <> cs (pgFmtLit role) <> ";"