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 FlexibleContexts #-}
17 {-# LANGUAGE FlexibleInstances #-}
18 {-# LANGUAGE FunctionalDependencies #-}
19 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
20 {-# LANGUAGE MultiParamTypeClasses #-}
21 {-# LANGUAGE NoImplicitPrelude #-}
22 {-# LANGUAGE OverloadedStrings #-}
23 {-# LANGUAGE QuasiQuotes #-}
24 {-# LANGUAGE RankNTypes #-}
25 {-# LANGUAGE TemplateHaskell #-}
28 module Gargantext.Database.Schema.NodesNgramsRepo
31 import Data.Map.Strict.Patch (PatchMap)
32 import Gargantext.Database.Schema.Prelude
33 import Gargantext.API.Ngrams (NgramsStatePatch, NgramsTablePatch)
34 import Gargantext.Database.Schema.Ngrams (NgramsType)
35 import Gargantext.Database.Admin.Types.Node (NodeId)
36 import Gargantext.Prelude
39 data RepoDbPoly version patches
40 = RepoDbNgrams { _rdp_version :: !version
41 , _rdp_patches :: !patches
45 = RepoDbPoly (Column PGInt4)
48 = RepoDbPoly (Column PGInt4)
51 type RepoDbNgrams = RepoDbPoly Int NgramsStatePatch
52 $(makeAdaptorAndInstance "pRepoDbNgrams" ''RepoDbPoly)
53 makeLenses ''RepoDbPoly
55 instance QueryRunnerColumnDefault PGJsonb
57 (PatchMap NodeId NgramsTablePatch))
59 queryRunnerColumnDefault = fieldQueryRunnerColumn
61 repoTable :: Table RepoDbWrite RepoDbRead
62 repoTable = Table "nodes_ngrams_repo"
63 (pRepoDbNgrams RepoDbNgrams
64 { _rdp_version = required "version"
65 , _rdp_patches = required "patches"