2 Module : Gargantext.Database.Schema.NodesNgramsRepo
3 Description : NodeNgram for Ngram indexation or Lists
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
13 {-# OPTIONS_GHC -fno-warn-orphans #-}
15 {-# LANGUAGE Arrows #-}
16 {-# LANGUAGE FunctionalDependencies #-}
17 {-# LANGUAGE QuasiQuotes #-}
18 {-# LANGUAGE TemplateHaskell #-}
21 module Gargantext.Database.Schema.NodesNgramsRepo
24 import Data.Map.Strict.Patch (PatchMap)
25 import Gargantext.Database.Schema.Prelude
26 import Gargantext.API.Ngrams (NgramsStatePatch, NgramsTablePatch)
27 import Gargantext.Database.Schema.Ngrams (NgramsType)
28 import Gargantext.Database.Admin.Types.Node (NodeId)
29 import Gargantext.Prelude
32 data RepoDbPoly version patches
33 = RepoDbNgrams { _rdp_version :: !version
34 , _rdp_patches :: !patches
38 = RepoDbPoly (Column PGInt4)
41 = RepoDbPoly (Column PGInt4)
44 type RepoDbNgrams = RepoDbPoly Int NgramsStatePatch
45 $(makeAdaptorAndInstance "pRepoDbNgrams" ''RepoDbPoly)
46 makeLenses ''RepoDbPoly
48 instance QueryRunnerColumnDefault PGJsonb
50 (PatchMap NodeId NgramsTablePatch))
52 queryRunnerColumnDefault = fieldQueryRunnerColumn
54 repoTable :: Table RepoDbWrite RepoDbRead
55 repoTable = Table "nodes_ngrams_repo"
56 (pRepoDbNgrams RepoDbNgrams
57 { _rdp_version = required "version"
58 , _rdp_patches = required "patches"