2 Module : Gargantext.Database.Schema.NodeNode
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
10 Here is a longer description of this module, containing some
11 commentary with @some markup@.
14 {-# OPTIONS_GHC -fno-warn-orphans #-}
16 {-# LANGUAGE Arrows #-}
17 {-# LANGUAGE FunctionalDependencies #-}
18 {-# LANGUAGE QuasiQuotes #-}
19 {-# LANGUAGE TemplateHaskell #-}
21 module Gargantext.Database.Schema.NodeContext where
23 import Gargantext.Core.Types
24 import Gargantext.Database.Schema.Prelude
25 import Gargantext.Database.Schema.NodeNode () -- Just importing some instances
26 import Gargantext.Prelude
29 data NodeContextPoly node_id context_id score cat
30 = NodeContext { _nc_node_id :: !node_id
31 , _nc_context_id :: !context_id
33 , _nc_category :: !cat
36 type NodeContextWrite = NodeContextPoly (Column (SqlInt4))
38 (Maybe (Column (SqlFloat8)))
39 (Maybe (Column (SqlInt4)))
41 type NodeContextRead = NodeContextPoly (Column (SqlInt4))
46 type NodeContextReadNull = NodeContextPoly (Column (Nullable SqlInt4))
47 (Column (Nullable SqlInt4))
48 (Column (Nullable SqlFloat8))
49 (Column (Nullable SqlInt4))
51 type NodeContext = NodeContextPoly NodeId NodeId (Maybe Double) (Maybe Int)
53 $(makeAdaptorAndInstance "pNodeContext" ''NodeContextPoly)
54 makeLenses ''NodeContextPoly
56 nodeContextTable :: Table NodeContextWrite NodeContextRead
58 Table "nodes_contexts"
60 NodeContext { _nc_node_id = requiredTableField "node_id"
61 , _nc_context_id = requiredTableField "context_id"
62 , _nc_score = optionalTableField "score"
63 , _nc_category = optionalTableField "category"