code cleanup

This commit is contained in:
Ruslan Talpa
2015-10-23 10:13:51 +03:00
parent 21bd921ee7
commit d4a8716a0e
2 changed files with 43 additions and 126 deletions
+7 -1
View File
@@ -329,6 +329,13 @@ paramFilter :: JSON.Value -> T.Text
paramFilter JSON.Null = "is.null"
paramFilter v = "eq." <> unquoted v
wrapQuery :: T.Text -> [T.Text] -> Maybe NonnegRange -> T.Text
wrapQuery source selectColumns range =
withSourceF source <>
" SELECT " <>
T.intercalate ", " selectColumns <>
" " <>
fromF ( limitF range )
withSourceF :: T.Text -> T.Text
withSourceF s = "WITH source AS (" <> s <>")"
@@ -378,7 +385,6 @@ locationF :: [T.Text] -> T.Text
locationF pKeys =
"(" <>
" WITH s AS (SELECT row_to_json(source) as r from source limit 1)" <>
-- " SELECT string_agg(json_data.key || '=eq.' || json_data.value, '&')" <>
" SELECT string_agg(json_data.key || '=' || coalesce( 'eq.' || json_data.value, 'is.null'), '&')" <>
" FROM s, json_each_text(s.r) AS json_data" <>
(