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 FlexibleContexts #-}
16 {-# LANGUAGE FlexibleInstances #-}
17 {-# LANGUAGE FunctionalDependencies #-}
18 {-# LANGUAGE MultiParamTypeClasses #-}
19 {-# LANGUAGE NoImplicitPrelude #-}
20 {-# LANGUAGE RankNTypes #-}
21 {-# LANGUAGE TemplateHaskell #-}
23 module Gargantext.Database.Query.Table.NodeNodeNgrams2
24 ( module Gargantext.Database.Schema.NodeNodeNgrams2
25 , insertNodeNodeNgrams2
29 import Gargantext.Database.Schema.Prelude
30 import Gargantext.Database.Schema.NodeNodeNgrams2
31 import Gargantext.Database.Admin.Types.Node (pgNodeId)
32 import Gargantext.Database.Admin.Utils (Cmd, mkCmd)
36 _queryNodeNodeNgrams2Table :: Query NodeNodeNgrams2Read
37 _queryNodeNodeNgrams2Table = queryTable nodeNodeNgrams2Table
40 insertNodeNodeNgrams2 :: [NodeNodeNgrams2] -> Cmd err Int
41 insertNodeNodeNgrams2 = insertNodeNodeNgrams2W
42 . map (\(NodeNodeNgrams2 n1 n2 w) ->
43 NodeNodeNgrams2 (pgNodeId n1)
48 insertNodeNodeNgrams2W :: [NodeNodeNgrams2Write] -> Cmd err Int
49 insertNodeNodeNgrams2W nnnw =
50 mkCmd $ \c -> fromIntegral <$> runInsert_ c insertNothing
52 insertNothing = Insert { iTable = nodeNodeNgrams2Table
55 , iOnConflict = (Just DoNothing)