NodeNodeNgrams2.hs 2.06 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
{-|
Module      : Gargantext.Database.Schema.NodeNodeNgrams
Description : TODO: remove this module and table in database
Copyright   : (c) CNRS, 2017-Present
License     : AGPL + CECILL v3
Maintainer  : team@gargantext.org
Stability   : experimental
Portability : POSIX

-}

{-# OPTIONS_GHC -fno-warn-orphans #-}

{-# LANGUAGE Arrows                 #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE TemplateHaskell        #-}

18
module Gargantext.Database.Schema.NodeNodeNgrams2
19 20
  where

21
import Gargantext.Database.Schema.Prelude
22
import Gargantext.Database.Schema.NodeNgrams (NodeNgramsId)
23 24
import Gargantext.Database.Admin.Types.Node
import Prelude
25 26

data NodeNodeNgrams2Poly node_id nodengrams_id w
27 28 29
   = NodeNodeNgrams2 { _nnng2_node_id       :: !node_id
                     , _nnng2_nodengrams_id :: !nodengrams_id
                     , _nnng2_weight        :: !w
30 31 32
                     } deriving (Show)

type NodeNodeNgrams2Write =
33 34 35
     NodeNodeNgrams2Poly (Column SqlInt4  )
                         (Column SqlInt4  )
                         (Column SqlFloat8)
36 37

type NodeNodeNgrams2Read  =
38 39 40
     NodeNodeNgrams2Poly (Column SqlInt4  )
                         (Column SqlInt4  )
                         (Column SqlFloat8)
41 42

type NodeNodeNgrams2ReadNull =
43 44 45
     NodeNodeNgrams2Poly (Column (Nullable SqlInt4  ))
                         (Column (Nullable SqlInt4  ))
                         (Column (Nullable SqlFloat8))
46 47 48 49 50 51 52 53 54 55

type NodeNodeNgrams2 =
  NodeNodeNgrams2Poly DocId NodeNgramsId Double

$(makeAdaptorAndInstance "pNodeNodeNgrams2" ''NodeNodeNgrams2Poly)
makeLenses ''NodeNodeNgrams2Poly

nodeNodeNgrams2Table :: Table NodeNodeNgrams2Write NodeNodeNgrams2Read
nodeNodeNgrams2Table  = Table "node_node_ngrams2"
                          ( pNodeNodeNgrams2 NodeNodeNgrams2
56 57 58
                               { _nnng2_node_id        = requiredTableField "node_id"
                               , _nnng2_nodengrams_id  = requiredTableField "nodengrams_id"
                               , _nnng2_weight         = requiredTableField "weight"
59 60 61
                               }
                          )