2 Module : Gargantext.Database.Schema.NodeNodeNgrams
3 Description : TODO: remove this module and table in database
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 TemplateHaskell #-}
18 module Gargantext.Database.Query.Table.NodeNodeNgrams
19 ( module Gargantext.Database.Schema.NodeNodeNgrams
20 , queryNodeNodeNgramsTable
21 , insertNodeNodeNgrams
25 import Gargantext.Database.Admin.Types.Node (pgNodeId)
26 import Gargantext.Database.Prelude (Cmd, mkCmd)
27 import Gargantext.Database.Schema.Ngrams (pgNgramsTypeId)
28 import Gargantext.Database.Schema.NodeNodeNgrams
29 import Gargantext.Database.Schema.Prelude
33 queryNodeNodeNgramsTable :: Query NodeNodeNgramsRead
34 queryNodeNodeNgramsTable = selectTable nodeNodeNgramsTable
37 insertNodeNodeNgrams :: [NodeNodeNgrams] -> Cmd err Int
38 insertNodeNodeNgrams = insertNodeNodeNgramsW
39 . map (\(NodeNodeNgrams n1 n2 ng nt w) ->
40 NodeNodeNgrams (pgNodeId n1)
47 insertNodeNodeNgramsW :: [NodeNodeNgramsWrite] -> Cmd err Int
48 insertNodeNodeNgramsW nnnw =
49 mkCmd $ \c -> fromIntegral <$> runInsert_ c insertNothing
51 insertNothing = (Insert { iTable = nodeNodeNgramsTable
54 , iOnConflict = (Just DoNothing)