import Data.ByteString.Char8 (hPutStrLn)
import Data.Either.Extra (Either(Left, Right))
import Data.Ini (readIniFile, lookupValue)
-import Data.Maybe (maybe)
-import Data.Monoid ((<>))
import Data.Pool (Pool, withResource)
import Data.Profunctor.Product.Default (Default)
import Data.Text (unpack, pack)
-import Data.Typeable (Typeable)
import Data.Word (Word16)
import Database.PostgreSQL.Simple (Connection, connect)
import Database.PostgreSQL.Simple.FromField ( Conversion, ResultError(ConversionFailed), fromField, returnError)
import Database.PostgreSQL.Simple.Internal (Field)
-import Gargantext.Prelude
-import Gargantext.Prelude.Config (GargConfig())
import Opaleye (Query, Unpackspec, showSqlForPostgres, FromFields, Select, runQuery)
import Opaleye.Aggregate (countRows)
import System.IO (FilePath)
import qualified Data.List as DL
import qualified Database.PostgreSQL.Simple as PGS
+import Gargantext.Prelude
+import Gargantext.Prelude.Config (GargConfig())
+
-------------------------------------------------------
class HasConnectionPool env where
connPool :: Getter env (Pool Connection)
withResource pool (liftBase . k)
runCmd :: (HasConnectionPool env)
- => env -> Cmd' env err a
+ => env
+ -> Cmd' env err a
-> IO (Either err a)
runCmd env m = runExceptT $ runReaderT m env
runOpaQuery :: Default FromFields fields haskells
- => Select fields -> Cmd err [haskells]
+ => Select fields
+ -> Cmd err [haskells]
runOpaQuery q = mkCmd $ \c -> runQuery c q
runCountOpaQuery :: Select a -> Cmd err Int