]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Query/Table/NodesNgramsRepo.hs
[REFACT] Types work (WIP)
[gargantext.git] / src / Gargantext / Database / Query / Table / NodesNgramsRepo.hs
1 {-|
2 Module : Gargantext.Database.Schema.NodesNgramsRepo
3 Description :
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10 -}
11
12 {-# OPTIONS_GHC -fno-warn-orphans #-}
13
14 {-# LANGUAGE Arrows #-}
15 {-# LANGUAGE FunctionalDependencies #-}
16 {-# LANGUAGE QuasiQuotes #-}
17 {-# LANGUAGE TemplateHaskell #-}
18
19 module Gargantext.Database.Query.Table.NodesNgramsRepo
20 ( module Gargantext.Database.Schema.NodesNgramsRepo
21 )
22 where
23
24 import Gargantext.Database.Schema.Prelude
25 import Gargantext.API.Ngrams (NgramsStatePatch)
26 import Gargantext.Database.Schema.NodesNgramsRepo
27 import Gargantext.Database.Prelude (mkCmd, Cmd, runOpaQuery)
28 import Gargantext.Prelude
29
30
31 selectPatches :: Query RepoDbRead
32 selectPatches = proc () -> do
33 repos <- queryTable repoTable -< ()
34 returnA -< repos
35
36 _selectRepo :: Cmd err [RepoDbNgrams]
37 _selectRepo = runOpaQuery selectPatches
38
39 _insertRepos :: [NgramsStatePatch] -> Cmd err Int64
40 _insertRepos ns = mkCmd $ \conn -> runInsert_ conn $ Insert repoTable (toWrite ns) rCount Nothing
41 where
42 toWrite :: [NgramsStatePatch] -> [RepoDbWrite]
43 toWrite = undefined
44 --ns' = map (\(RepoDbNgrams v ps) -> RepoDbWrite (pgInt4 v) (pgJSONB ps)) ns
45