]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Schema/ContextNodeNgrams.hs
[opaleye] remove ReadNull type instances
[gargantext.git] / src / Gargantext / Database / Schema / ContextNodeNgrams.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.ContextNodeNgrams
19 where
20
21 import Prelude
22 import Gargantext.Core.Types (TermsCount)
23 import Gargantext.Database.Schema.Prelude
24 import Gargantext.Database.Schema.Ngrams (NgramsTypeId, NgramsId)
25 import Gargantext.Database.Admin.Types.Node
26
27
28
29 type ContextNodeNgrams =
30 ContextNodeNgramsPoly ContextId ListId NgramsId NgramsTypeId Double TermsCount
31
32
33 data ContextNodeNgramsPoly c n ngrams_id ngt w dc
34 = ContextNodeNgrams { _cnng_context_id :: !c
35 , _cnng_node_id :: !n
36 , _cnng_ngrams_id :: !ngrams_id
37 , _cnng_ngramsType :: !ngt
38 , _cnng_weight :: !w
39 , _cnng_doc_count :: !dc
40 } deriving (Show)
41
42 type ContextNodeNgramsWrite =
43 ContextNodeNgramsPoly (Field SqlInt4 )
44 (Field SqlInt4 )
45 (Field SqlInt4 )
46 (Field SqlInt4 )
47 (Field SqlFloat8)
48 (Field SqlInt4 )
49
50 type ContextNodeNgramsRead =
51 ContextNodeNgramsPoly (Field SqlInt4 )
52 (Field SqlInt4 )
53 (Field SqlInt4 )
54 (Field SqlInt4 )
55 (Field SqlFloat8)
56 (Field SqlInt4 )
57
58 $(makeAdaptorAndInstance "pContextNodeNgrams" ''ContextNodeNgramsPoly)
59 makeLenses ''ContextNodeNgramsPoly
60
61
62 contextNodeNgramsTable :: Table ContextNodeNgramsWrite ContextNodeNgramsRead
63 contextNodeNgramsTable = Table "context_node_ngrams"
64 ( pContextNodeNgrams ContextNodeNgrams
65 { _cnng_context_id = requiredTableField "context_id"
66 , _cnng_node_id = requiredTableField "node_id"
67 , _cnng_ngrams_id = requiredTableField "ngrams_id"
68 , _cnng_ngramsType = requiredTableField "ngrams_type"
69 , _cnng_weight = requiredTableField "weight"
70 , _cnng_doc_count = requiredTableField "doc_count"
71 }
72 )
73
74 -- queryContextNodeNgramsTable :: Select ContextNodeNgramsRead
75 -- queryContextNodeNgramsTable = selectTable contextNodeNgramsTable