]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Schema/ContextNodeNgrams2.hs
[FIX] Ngrams in list
[gargantext.git] / src / Gargantext / Database / Schema / ContextNodeNgrams2.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.ContextNodeNgrams2
19 where
20
21 import Gargantext.Database.Admin.Types.Node
22 import Gargantext.Database.Schema.NodeNgrams (NodeNgramsId)
23 import Gargantext.Database.Schema.Prelude
24 import Prelude
25
26
27 type ContextNodeNgrams2 = ContextNodeNgrams2Poly ContextId NodeNgramsId Double
28
29
30 data ContextNodeNgrams2Poly context_id nodengrams_id w
31 = ContextNodeNgrams2 { _cnng2_context_id :: !context_id
32 , _cnng2_nodengrams_id :: !nodengrams_id
33 , _cnng2_weight :: !w
34 } deriving (Show)
35
36 type ContextNodeNgrams2Write =
37 ContextNodeNgrams2Poly (Column SqlInt4 )
38 (Column SqlInt4 )
39 (Column SqlFloat8)
40
41 type ContextNodeNgrams2Read =
42 ContextNodeNgrams2Poly (Column SqlInt4 )
43 (Column SqlInt4 )
44 (Column SqlFloat8)
45
46 type ContextNodeNgrams2ReadNull =
47 ContextNodeNgrams2Poly (Column (Nullable SqlInt4 ))
48 (Column (Nullable SqlInt4 ))
49 (Column (Nullable SqlFloat8))
50
51 $(makeAdaptorAndInstance "pContextNodeNgrams2" ''ContextNodeNgrams2Poly)
52 makeLenses ''ContextNodeNgrams2Poly
53
54 contextNodeNgrams2Table :: Table ContextNodeNgrams2Write ContextNodeNgrams2Read
55 contextNodeNgrams2Table = Table "context_node_ngrams2"
56 ( pContextNodeNgrams2 ContextNodeNgrams2
57 { _cnng2_context_id = requiredTableField "context_id"
58 , _cnng2_nodengrams_id = requiredTableField "nodengrams_id"
59 , _cnng2_weight = requiredTableField "weight"
60 }
61 )