Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
158
Issues
158
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
c4f3f4ea
Commit
c4f3f4ea
authored
Apr 06, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
ssh://gitlab.iscpif.fr:20022/gargantext/haskell-gargantext
into dev
parents
0f0f9520
b98e2c04
Pipeline
#803
canceled with stage
Changes
14
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
32 additions
and
13 deletions
+32
-13
package.yaml
package.yaml
+2
-0
Settings.hs
src/Gargantext/API/Settings.hs
+2
-2
Add.hs
src/Gargantext/Database/Node/Document/Add.hs
+2
-0
Update.hs
src/Gargantext/Database/Node/Update.hs
+1
-0
UpdateOpaleye.hs
src/Gargantext/Database/Node/UpdateOpaleye.hs
+1
-0
Ngrams.hs
src/Gargantext/Database/Schema/Ngrams.hs
+1
-0
NodeNode.hs
src/Gargantext/Database/Schema/NodeNode.hs
+1
-0
Node_NodeNgramsNodeNgrams.hs
src/Gargantext/Database/Schema/Node_NodeNgramsNodeNgrams.hs
+1
-0
User.hs
src/Gargantext/Database/Schema/User.hs
+1
-0
Tree.hs
src/Gargantext/Database/Tree.hs
+1
-0
NodeNodeNgrams.hs
src/Gargantext/Database/Triggers/NodeNodeNgrams.hs
+1
-0
Nodes.hs
src/Gargantext/Database/Triggers/Nodes.hs
+1
-0
NodesNodes.hs
src/Gargantext/Database/Triggers/NodesNodes.hs
+1
-0
Utils.hs
src/Gargantext/Database/Utils.hs
+16
-11
No files found.
package.yaml
View file @
c4f3f4ea
...
...
@@ -151,6 +151,8 @@ library:
-
logging-effect
-
matrix
-
monad-logger
-
monad-control
-
resource-pool
-
mtl
-
natural-transformation
-
opaleye
...
...
src/Gargantext/API/Settings.hs
View file @
c4f3f4ea
...
...
@@ -309,11 +309,11 @@ withDevEnv iniPath k = do
where
newDevEnv
=
do
param
<-
databaseParameters
iniPath
conn
<-
connect
param
pool
<-
newPool
param
repo
<-
readRepoEnv
setts
<-
devSettings
devJwkFile
pure
$
DevEnv
{
_dev_env_
conn
=
conn
{
_dev_env_
pool
=
pool
,
_dev_env_repo
=
repo
,
_dev_env_settings
=
setts
}
...
...
src/Gargantext/Database/Node/Document/Add.hs
View file @
c4f3f4ea
...
...
@@ -13,6 +13,8 @@ Add Documents/Contact to a Corpus/Annuaire.
------------------------------------------------------------------------
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
...
...
src/Gargantext/Database/Node/Update.hs
View file @
c4f3f4ea
...
...
@@ -9,6 +9,7 @@ Portability : POSIX
-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
...
...
src/Gargantext/Database/Node/UpdateOpaleye.hs
View file @
c4f3f4ea
...
...
@@ -9,6 +9,7 @@ Portability : POSIX
-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
...
...
src/Gargantext/Database/Schema/Ngrams.hs
View file @
c4f3f4ea
...
...
@@ -13,6 +13,7 @@ Ngrams connection to the Database.
{-# LANGUAGE Arrows #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
...
...
src/Gargantext/Database/Schema/NodeNode.hs
View file @
c4f3f4ea
...
...
@@ -14,6 +14,7 @@ commentary with @some markup@.
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE Arrows #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE QuasiQuotes #-}
...
...
src/Gargantext/Database/Schema/Node_NodeNgramsNodeNgrams.hs
View file @
c4f3f4ea
...
...
@@ -22,6 +22,7 @@ Next Step benchmark:
-}
{-# LANGUAGE Arrows #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
...
...
src/Gargantext/Database/Schema/User.hs
View file @
c4f3f4ea
...
...
@@ -14,6 +14,7 @@ Functions to deal with users, database side.
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FunctionalDependencies #-}
...
...
src/Gargantext/Database/Tree.hs
View file @
c4f3f4ea
...
...
@@ -12,6 +12,7 @@ Let a Root Node, return the Tree of the Node as a directed acyclic graph
-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE RankNTypes #-}
...
...
src/Gargantext/Database/Triggers/NodeNodeNgrams.hs
View file @
c4f3f4ea
...
...
@@ -11,6 +11,7 @@ Triggers on NodeNodeNgrams table.
-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
...
...
src/Gargantext/Database/Triggers/Nodes.hs
View file @
c4f3f4ea
...
...
@@ -11,6 +11,7 @@ Triggers on Nodes table.
-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
...
...
src/Gargantext/Database/Triggers/NodesNodes.hs
View file @
c4f3f4ea
...
...
@@ -11,6 +11,7 @@ Triggers on NodesNodes table.
-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
...
...
src/Gargantext/Database/Utils.hs
View file @
c4f3f4ea
...
...
@@ -13,6 +13,7 @@ commentary with @some markup@.
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
...
...
@@ -22,10 +23,11 @@ module Gargantext.Database.Utils where
import
Data.ByteString.Char8
(
hPutStrLn
)
import
System.IO
(
stderr
)
import
Control.Exception
import
Control.Exception
import
Control.Monad.Error.Class
-- (MonadError(..), Error)
import
Control.Lens
(
Getter
,
view
)
import
Control.Monad.Reader
import
Control.Monad.Trans.Control
(
MonadBaseControl
)
import
Control.Monad.Except
import
Data.Aeson
(
Result
(
Error
,
Success
),
fromJSON
,
FromJSON
)
import
Data.Either.Extra
(
Either
(
Left
,
Right
))
...
...
@@ -33,10 +35,12 @@ import Data.Ini (readIniFile, lookupValue)
import
qualified
Data.List
as
DL
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, Pool, connect, withPoolConnection)
import
Database.PostgreSQL.Simple
(
Connection
,
connect
)
import
Database.PostgreSQL.Simple.FromField
(
Conversion
,
ResultError
(
ConversionFailed
),
fromField
,
returnError
)
import
Database.PostgreSQL.Simple.Internal
(
Field
)
...
...
@@ -48,11 +52,11 @@ import Text.Read (read)
import
qualified
Data.ByteString
as
DB
import
qualified
Database.PostgreSQL.Simple
as
PGS
class
HasConnection
env
where
conn
ection
::
Getter
env
Connection
class
HasConnection
Pool
env
where
conn
Pool
::
Getter
env
(
Pool
Connection
)
instance
HasConnection
Connection
where
conn
ection
=
identity
instance
HasConnection
Pool
(
Pool
Connection
)
where
conn
Pool
=
identity
type
CmdM'
env
err
m
=
(
MonadReader
env
m
...
...
@@ -62,7 +66,8 @@ type CmdM' env err m =
type
CmdM
env
err
m
=
(
CmdM'
env
err
m
,
HasConnection
env
,
MonadBaseControl
IO
m
,
HasConnectionPool
env
)
type
Cmd'
env
err
a
=
forall
m
.
CmdM'
env
err
m
=>
m
a
...
...
@@ -75,10 +80,10 @@ fromInt64ToInt = fromIntegral
-- TODO: ideally there should be very few calls to this functions.
mkCmd
::
(
Connection
->
IO
a
)
->
Cmd
err
a
mkCmd
k
=
do
conn
<-
view
connection
liftIO
$
k
conn
pool
<-
view
connPool
withResource
pool
(
liftIO
.
k
)
runCmd
::
(
HasConnection
env
)
runCmd
::
(
HasConnection
Pool
env
)
=>
env
->
Cmd'
env
err
a
->
IO
(
Either
err
a
)
runCmd
env
m
=
runExceptT
$
runReaderT
m
env
...
...
@@ -100,8 +105,8 @@ formatPGSQuery q a = mkCmd $ \conn -> PGS.formatQuery conn q a
runPGSQuery'
::
(
PGS
.
ToRow
a
,
PGS
.
FromRow
b
)
=>
PGS
.
Query
->
a
->
Cmd
err
[
b
]
runPGSQuery'
q
a
=
mkCmd
$
\
conn
->
PGS
.
query
conn
q
a
runPGSQuery
::
(
MonadError
err
m
,
MonadReader
env
m
,
PGS
.
FromRow
r
,
PGS
.
ToRow
q
,
MonadIO
m
,
HasConnection
env
)
runPGSQuery
::
(
MonadError
err
m
,
MonadReader
env
m
,
MonadBaseControl
IO
m
,
PGS
.
FromRow
r
,
PGS
.
ToRow
q
,
MonadIO
m
,
HasConnection
Pool
env
)
=>
PGS
.
Query
->
q
->
m
[
r
]
runPGSQuery
q
a
=
mkCmd
$
\
conn
->
catch
(
PGS
.
query
conn
q
a
)
(
printError
conn
)
where
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment