2 Module : Gargantext.Database.Query.Table.NodeNode_NodeNode
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
12 {-# OPTIONS_GHC -fno-warn-orphans #-}
14 {-# LANGUAGE Arrows #-}
15 {-# LANGUAGE FunctionalDependencies #-}
16 {-# LANGUAGE QuasiQuotes #-}
17 {-# LANGUAGE TemplateHaskell #-}
19 module Gargantext.Database.Query.Table.NodeNode
22 import Control.Arrow (returnA)
23 import Control.Lens (view, (^.))
24 import Data.Maybe (catMaybes)
25 import Data.Text (Text, splitOn)
26 import Database.PostgreSQL.Simple.SqlQQ (sql)
27 import Database.PostgreSQL.Simple.Types (Values(..), QualifiedIdentifier(..))
28 import qualified Database.PostgreSQL.Simple as PGS (Query, Only(..))
29 import qualified Opaleye as O
32 import Gargantext.Core.Types
33 import Gargantext.Database.Schema.NodeNode_NodeNode
34 import Gargantext.Database.Admin.Config (nodeTypeId)
35 import Gargantext.Database.Admin.Types.Hyperdata
36 import Gargantext.Database.Admin.Types.Node (CorpusId, DocId, pgNodeId)
37 import Gargantext.Database.Prelude
38 import Gargantext.Database.Schema.Node
39 import Gargantext.Prelude
42 queryNodeNode_NodeNodeTable :: Query NodeNode_NodeNodeRead
43 queryNodeNode_NodeNodeTable = queryTable nodeNode_NodeNodeTable
45 ------------------------------------------------------------------------
46 insertNodeNode_NodeNode :: [NodeNode_NodeNode] -> Cmd err Int64
47 insertNodeNode_NodeNode ns = mkCmd $ \conn -> runInsert_ conn
48 $ Insert nodeNode_NodeNodeTable ns' rCount Nothing
50 ns' :: [NodeNode_NodeNodeWrite]
51 ns' = map (\(NodeNode_NodeNode nn1 nn2 w)
52 -> NodeNode_NodeNode (pgInt4 nn1)
57 ------------------------------------------------------------------------
61 ------------------------------------------------------------------------