]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Schema/NodeNodeNgrams.hs
[WIP] Graph Debug
[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 FunctionalDependencies #-}
16 {-# LANGUAGE TemplateHaskell #-}
17
18 module Gargantext.Database.Schema.NodeNodeNgrams
19 where
20
21 import Prelude
22 import Gargantext.Database.Schema.Prelude
23 import Gargantext.Database.Schema.Ngrams (NgramsTypeId, NgramsId)
24 import Gargantext.Database.Admin.Types.Node
25
26 data NodeNodeNgramsPoly n1 n2 ngrams_id ngt w
27 = NodeNodeNgrams { _nnng_node1_id :: !n1
28 , _nnng_node2_id :: !n2
29 , _nnng_ngrams_id :: !ngrams_id
30 , _nnng_ngramsType :: !ngt
31 , _nnng_weight :: !w
32 } deriving (Show)
33
34 type NodeNodeNgramsWrite =
35 NodeNodeNgramsPoly (Column SqlInt4 )
36 (Column SqlInt4 )
37 (Column SqlInt4 )
38 (Column SqlInt4 )
39 (Column SqlFloat8)
40
41 type NodeNodeNgramsRead =
42 NodeNodeNgramsPoly (Column SqlInt4 )
43 (Column SqlInt4 )
44 (Column SqlInt4 )
45 (Column SqlInt4 )
46 (Column SqlFloat8)
47
48 type NodeNodeNgramsReadNull =
49 NodeNodeNgramsPoly (Column (Nullable SqlInt4 ))
50 (Column (Nullable SqlInt4 ))
51 (Column (Nullable SqlInt4 ))
52 (Column (Nullable SqlInt4 ))
53 (Column (Nullable SqlFloat8))
54
55 type NodeNodeNgrams =
56 NodeNodeNgramsPoly CorpusId DocId NgramsId NgramsTypeId Double
57
58 $(makeAdaptorAndInstance "pNodeNodeNgrams" ''NodeNodeNgramsPoly)
59 makeLenses ''NodeNodeNgramsPoly
60
61
62 nodeNodeNgramsTable :: Table NodeNodeNgramsWrite NodeNodeNgramsRead
63 nodeNodeNgramsTable = Table "node_node_ngrams"
64 ( pNodeNodeNgrams NodeNodeNgrams
65 { _nnng_node1_id = requiredTableField "node1_id"
66 , _nnng_node2_id = requiredTableField "node2_id"
67 , _nnng_ngrams_id = requiredTableField "ngrams_id"
68 , _nnng_ngramsType = requiredTableField "ngrams_type"
69 , _nnng_weight = requiredTableField "weight"
70 }
71 )
72