]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Schema/NodeNodeNgrams2.hs
[ngrams] refactor some code related to getNgramsTable
[gargantext.git] / src / Gargantext / Database / Schema / NodeNodeNgrams2.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.NodeNodeNgrams2
19 where
20
21 import Gargantext.Database.Schema.Prelude
22 import Gargantext.Database.Schema.NodeNgrams (NodeNgramsId)
23 import Gargantext.Database.Admin.Types.Node
24 import Prelude
25
26 data NodeNodeNgrams2Poly node_id nodengrams_id w
27 = NodeNodeNgrams2 { _nnng2_node_id :: !node_id
28 , _nnng2_nodengrams_id :: !nodengrams_id
29 , _nnng2_weight :: !w
30 } deriving (Show)
31
32 type NodeNodeNgrams2Write =
33 NodeNodeNgrams2Poly (Column SqlInt4 )
34 (Column SqlInt4 )
35 (Column SqlFloat8)
36
37 type NodeNodeNgrams2Read =
38 NodeNodeNgrams2Poly (Column SqlInt4 )
39 (Column SqlInt4 )
40 (Column SqlFloat8)
41
42 type NodeNodeNgrams2ReadNull =
43 NodeNodeNgrams2Poly (Column (Nullable SqlInt4 ))
44 (Column (Nullable SqlInt4 ))
45 (Column (Nullable SqlFloat8))
46
47 type NodeNodeNgrams2 =
48 NodeNodeNgrams2Poly DocId NodeNgramsId Double
49
50 $(makeAdaptorAndInstance "pNodeNodeNgrams2" ''NodeNodeNgrams2Poly)
51 makeLenses ''NodeNodeNgrams2Poly
52
53 nodeNodeNgrams2Table :: Table NodeNodeNgrams2Write NodeNodeNgrams2Read
54 nodeNodeNgrams2Table = Table "node_node_ngrams2"
55 ( pNodeNodeNgrams2 NodeNodeNgrams2
56 { _nnng2_node_id = requiredTableField "node_id"
57 , _nnng2_nodengrams_id = requiredTableField "nodengrams_id"
58 , _nnng2_weight = requiredTableField "weight"
59 }
60 )
61