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
21 , queryContextNodeNgrams2Table
25 import Gargantext.Database.Schema.Prelude
26 import Gargantext.Database.Schema.ContextNodeNgrams2
27 import Gargantext.Database.Admin.Types.Node (pgNodeId)
28 import Gargantext.Database.Prelude (Cmd, mkCmd)
32 queryContextNodeNgrams2Table :: Query ContextNodeNgrams2Read
33 queryContextNodeNgrams2Table = selectTable contextNodeNgrams2Table
36 insertContextNodeNgrams2 :: [ContextNodeNgrams2] -> Cmd err Int
37 insertContextNodeNgrams2 = insertContextNodeNgrams2W
38 . map (\(ContextNodeNgrams2 n1 n2 w) ->
39 ContextNodeNgrams2 (pgNodeId n1)
44 insertContextNodeNgrams2W :: [ContextNodeNgrams2Write] -> Cmd err Int
45 insertContextNodeNgrams2W nnnw =
46 mkCmd $ \c -> fromIntegral <$> runInsert_ c insertNothing
48 insertNothing = Insert { iTable = contextNodeNgrams2Table
51 , iOnConflict = (Just DoNothing)