From d89937a6f300d2ca6bcda15cb84198450537467a Mon Sep 17 00:00:00 2001 From: Joe Nelson Date: Thu, 10 Aug 2017 01:54:15 -0500 Subject: [PATCH] Upgrade to fast new hasql (#836) --- circle.yml | 2 +- postgrest.cabal | 2 +- src/PostgREST/App.hs | 3 +-- src/PostgREST/QueryBuilder.hs | 5 ++--- stack.yaml | 4 +++- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/circle.yml b/circle.yml index 58dbda86c..0167bf262 100644 --- a/circle.yml +++ b/circle.yml @@ -10,7 +10,7 @@ dependencies: - stack setup - rm -fr $(stack path --dist-dir) $(stack path --local-install-root) - stack install hlint packdeps cabal-install - - stack build --fast + - stack build --fast -j1 - stack build --fast --test --no-run-tests test: diff --git a/postgrest.cabal b/postgrest.cabal index 62f4975b6..e72711619 100644 --- a/postgrest.cabal +++ b/postgrest.cabal @@ -142,7 +142,7 @@ Test-Suite spec , hasql-pool , heredoc , hjsonpointer - , hjsonschema + , hjsonschema == 1.5.0.1 , hspec , hspec-wai >= 0.7.0 , hspec-wai-json diff --git a/src/PostgREST/App.hs b/src/PostgREST/App.hs index f07f5ab67..7299631a8 100644 --- a/src/PostgREST/App.hs +++ b/src/PostgREST/App.hs @@ -1,7 +1,6 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TupleSections #-} ---module PostgREST.App where + module PostgREST.App ( postgrest ) where diff --git a/src/PostgREST/QueryBuilder.hs b/src/PostgREST/QueryBuilder.hs index 9f54dd6e6..4533b68d1 100644 --- a/src/PostgREST/QueryBuilder.hs +++ b/src/PostgREST/QueryBuilder.hs @@ -1,5 +1,4 @@ {-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE TupleSections #-} {-# OPTIONS_GHC -fno-warn-orphans #-} {-| Module : PostgREST.QueryBuilder @@ -149,7 +148,7 @@ callProc :: QualifiedIdentifier -> JSON.Object -> Bool -> SqlQuery -> SqlQuery - callProc qi params returnsScalar selectQuery countQuery _ countTotal isSingle paramsAsJson asCsv asBinary binaryField = unicodeStatement sql HE.unit decodeProc True where - sql = + sql = if returnsScalar then [qc| WITH {sourceCTEName} AS ({_callSql}) SELECT @@ -157,7 +156,7 @@ callProc qi params returnsScalar selectQuery countQuery _ countTotal isSingle pa 1 AS page_total, {scalarBodyF} as body FROM ({selectQuery}) _postgrest_t;|] - else [qc| + else [qc| WITH {sourceCTEName} AS ({_callSql}) SELECT {countResultF} AS total_result_set, diff --git a/stack.yaml b/stack.yaml index 3925a132e..77effbaa5 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,8 +1,10 @@ -resolver: lts-8.5 +resolver: lts-9.0 extra-deps: - configurator-ng-0.0.0.1 - critbit-0.2.0.0 - hasql-pool-0.4.1 + - hjsonpointer-1.1.1 + - hjsonschema-1.5.0.1 - jose-0.5.0.3 - Ranged-sets-0.3.0 ghc-options: