]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Schema/NodeNodeNgrams.hs
[OPTIM] after profiling, optimize serialisation
[gargantext.git] / src / Gargantext / Database / Schema / NodeNodeNgrams.hs
1 {-|
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
8 Portability : POSIX
9
10 -}
11
12 {-# OPTIONS_GHC -fno-warn-orphans #-}
13
14 {-# LANGUAGE Arrows #-}
15 {-# LANGUAGE FlexibleContexts #-}
16 {-# LANGUAGE FlexibleInstances #-}
17 {-# LANGUAGE FunctionalDependencies #-}
18 {-# LANGUAGE MultiParamTypeClasses #-}
19 {-# LANGUAGE NoImplicitPrelude #-}
20 {-# LANGUAGE RankNTypes #-}
21 {-# LANGUAGE TemplateHaskell #-}
22
23 module Gargantext.Database.Schema.NodeNodeNgrams
24 where
25
26 import Prelude
27 import Gargantext.Database.Schema.Prelude
28 import Gargantext.Database.Schema.Ngrams (NgramsTypeId, NgramsId)
29 import Gargantext.Database.Admin.Types.Node
30
31 data NodeNodeNgramsPoly n1 n2 ngrams_id ngt w
32 = NodeNodeNgrams { _nnng_node1_id :: !n1
33 , _nnng_node2_id :: !n2
34 , _nnng_ngrams_id :: !ngrams_id
35 , _nnng_ngramsType :: !ngt
36 , _nnng_weight :: !w
37 } deriving (Show)
38
39 type NodeNodeNgramsWrite =
40 NodeNodeNgramsPoly (Column PGInt4 )
41 (Column PGInt4 )
42 (Column PGInt4 )
43 (Column PGInt4 )
44 (Column PGFloat8)
45
46 type NodeNodeNgramsRead =
47 NodeNodeNgramsPoly (Column PGInt4 )
48 (Column PGInt4 )
49 (Column PGInt4 )
50 (Column PGInt4 )
51 (Column PGFloat8)
52
53 type NodeNodeNgramsReadNull =
54 NodeNodeNgramsPoly (Column (Nullable PGInt4 ))
55 (Column (Nullable PGInt4 ))
56 (Column (Nullable PGInt4 ))
57 (Column (Nullable PGInt4 ))
58 (Column (Nullable PGFloat8))
59
60 type NodeNodeNgrams =
61 NodeNodeNgramsPoly CorpusId DocId NgramsId NgramsTypeId Double
62
63 $(makeAdaptorAndInstance "pNodeNodeNgrams" ''NodeNodeNgramsPoly)
64 makeLenses ''NodeNodeNgramsPoly
65
66
67 nodeNodeNgramsTable :: Table NodeNodeNgramsWrite NodeNodeNgramsRead
68 nodeNodeNgramsTable = Table "node_node_ngrams"
69 ( pNodeNodeNgrams NodeNodeNgrams
70 { _nnng_node1_id = required "node1_id"
71 , _nnng_node2_id = required "node2_id"
72 , _nnng_ngrams_id = required "ngrams_id"
73 , _nnng_ngramsType = required "ngrams_type"
74 , _nnng_weight = required "weight"
75 }
76 )
77