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.ContextNodeNgrams
19 ( module Gargantext.Database.Schema.ContextNodeNgrams
20 , queryContextNodeNgramsTable
21 , insertContextNodeNgrams
25 import Gargantext.Database.Admin.Types.Node (pgNodeId, pgContextId)
26 import Gargantext.Database.Prelude (Cmd, mkCmd)
27 import Gargantext.Database.Schema.Ngrams (pgNgramsTypeId)
28 import Gargantext.Database.Schema.ContextNodeNgrams
29 import Gargantext.Database.Schema.Prelude
33 queryContextNodeNgramsTable :: Query ContextNodeNgramsRead
34 queryContextNodeNgramsTable = selectTable contextNodeNgramsTable
37 insertContextNodeNgrams :: [ContextNodeNgrams] -> Cmd err Int
38 insertContextNodeNgrams = insertContextNodeNgramsW
39 . map (\(ContextNodeNgrams c n ng nt w dc) ->
40 ContextNodeNgrams (pgContextId c)
48 insertContextNodeNgramsW :: [ContextNodeNgramsWrite] -> Cmd err Int
49 insertContextNodeNgramsW nnnw =
50 mkCmd $ \c -> fromIntegral <$> runInsert_ c insertNothing
52 insertNothing = Insert { iTable = contextNodeNgramsTable
55 , iOnConflict = (Just DoNothing)