]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Schema/NodesNgramsRepo.hs
[FIX] BUG email/username uniforming to Lower case
[gargantext.git] / src / Gargantext / Database / Schema / NodesNgramsRepo.hs
1 {-|
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
8 Portability : POSIX
9
10
11 -}
12
13 {-# OPTIONS_GHC -fno-warn-orphans #-}
14
15 {-# LANGUAGE Arrows #-}
16 {-# LANGUAGE FunctionalDependencies #-}
17 {-# LANGUAGE QuasiQuotes #-}
18 {-# LANGUAGE TemplateHaskell #-}
19
20
21 module Gargantext.Database.Schema.NodesNgramsRepo
22 where
23
24 {-
25 import Data.Map.Strict.Patch (PatchMap)
26
27 import Gargantext.Database.Schema.Prelude
28 import Gargantext.API.Ngrams.Types (NgramsTablePatch)
29 import Gargantext.Database.Schema.Ngrams (NgramsType)
30 import Gargantext.Database.Admin.Types.Node (NodeId)
31 import Gargantext.Prelude
32
33
34 data RepoDbPoly version patches
35 = RepoDbNgrams { _rdp_version :: !version
36 , _rdp_patches :: !patches
37 } deriving (Show)
38
39 type RepoDbWrite
40 = RepoDbPoly (Column SqlInt4)
41 (Column SqlJsonb)
42 type RepoDbRead
43 = RepoDbPoly (Column SqlInt4)
44 (Column SqlJsonb)
45
46 type RepoDbNgrams = RepoDbPoly Int NgramsStatePatch
47 $(makeAdaptorAndInstance "pRepoDbNgrams" ''RepoDbPoly)
48 makeLenses ''RepoDbPoly
49
50 instance DefaultFromField SqlJsonb
51 (PatchMap NgramsType
52 (PatchMap NodeId NgramsTablePatch))
53 where
54 defaultFromField = fromPGSFromField
55
56 repoTable :: Table RepoDbWrite RepoDbRead
57 repoTable = Table "nodes_ngrams_repo"
58 (pRepoDbNgrams RepoDbNgrams
59 { _rdp_version = requiredTableField "version"
60 , _rdp_patches = requiredTableField "patches"
61 }
62 )
63 -}