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