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.NodeNodeNgrams2
19 ( module Gargantext.Database.Schema.NodeNodeNgrams2
20 , insertNodeNodeNgrams2
24 import Gargantext.Database.Schema.Prelude
25 import Gargantext.Database.Schema.NodeNodeNgrams2
26 import Gargantext.Database.Admin.Types.Node (pgNodeId)
27 import Gargantext.Database.Prelude (Cmd, mkCmd)
31 _queryNodeNodeNgrams2Table :: Query NodeNodeNgrams2Read
32 _queryNodeNodeNgrams2Table = selectTable nodeNodeNgrams2Table
35 insertNodeNodeNgrams2 :: [NodeNodeNgrams2] -> Cmd err Int
36 insertNodeNodeNgrams2 = insertNodeNodeNgrams2W
37 . map (\(NodeNodeNgrams2 n1 n2 w) ->
38 NodeNodeNgrams2 (pgNodeId n1)
43 insertNodeNodeNgrams2W :: [NodeNodeNgrams2Write] -> Cmd err Int
44 insertNodeNodeNgrams2W nnnw =
45 mkCmd $ \c -> fromIntegral <$> runInsert_ c insertNothing
47 insertNothing = Insert { iTable = nodeNodeNgrams2Table
50 , iOnConflict = (Just DoNothing)