[opaleye] remove ReadNull type instances

They are changed to MaybeFields ...Read instead when joining.
parent a19f6924
......@@ -51,4 +51,3 @@ instance Arbitrary GraphMetric where
arbitrary = elements [ minBound .. maxBound ]
------------------------------------------------------------------------
......@@ -27,7 +27,6 @@ import Gargantext.Database.Admin.Types.Hyperdata (HyperdataDocument(..), Hyperda
import Gargantext.Database.Prelude (Cmd, runOpaQuery, runCountOpaQuery)
import Gargantext.Database.Query.Facet
import Gargantext.Database.Query.Filter
import Gargantext.Database.Query.Join (leftJoin5)
import Gargantext.Database.Query.Table.Node
import Gargantext.Database.Query.Table.Context
import Gargantext.Database.Query.Table.ContextNodeNgrams (queryContextNodeNgramsTable)
......@@ -251,55 +250,3 @@ queryContactViaDoc = proc () -> do
\doc' -> justFields (doc' ^. cs_id) .=== (view nc_context_id <$> corpus)
returnA -< (contact, annuaire, nodeContext_nodeContext, corpus, doc)
queryContactViaDoc' :: O.Select ( ContextSearchRead
, ( NodeContextReadNull
, ( NodeContext_NodeContextReadNull
, ( NodeContextReadNull
, ContextReadNull
)
)
)
)
queryContactViaDoc' =
leftJoin5
queryContextTable
queryNodeContextTable
queryNodeContext_NodeContextTable
queryNodeContextTable
queryContextSearchTable
cond12
cond23
cond34
cond45
where
cond12 :: (NodeContextRead, ContextRead) -> Column SqlBool
cond12 (annuaire, contact) = contact^.context_id .== annuaire^.nc_context_id
cond23 :: ( NodeContext_NodeContextRead
, ( NodeContextRead
, ContextReadNull
)
) -> Column SqlBool
cond23 (nodeContext_nodeContext, (annuaire, _)) = nodeContext_nodeContext^.ncnc_nodecontext2 .== annuaire^.nc_id
cond34 :: ( NodeContextRead
, ( NodeContext_NodeContextRead
, ( NodeContextReadNull
, ContextReadNull
)
)
) -> Column SqlBool
cond34 (corpus, (nodeContext_nodeContext, (_,_))) = nodeContext_nodeContext^.ncnc_nodecontext1 .== corpus^.nc_id
cond45 :: ( ContextSearchRead
, ( NodeContextRead
, ( NodeContext_NodeContextReadNull
, ( NodeContextReadNull
, ContextReadNull
)
)
)
) -> Column SqlBool
cond45 (doc, (corpus, (_,(_,_)))) = doc^.cs_id .== corpus^.nc_context_id
......@@ -88,20 +88,6 @@ nodeNode_node_User = proc () -> do
returnA -< (nn, n, u)
-- nodeNode_node_User' :: O.Select (NodeNodeRead, (NodeReadNull, UserReadNull))
-- nodeNode_node_User' = leftJoin3' queryNodeNodeTable
-- queryNodeTable
-- queryUserTable
-- cond12
-- cond23
-- where
-- cond12 :: (NodeNodeRead, (NodeRead, UserReadNull)) -> Column SqlBool
-- cond12 (nn, (n, _u)) = (nn^.nn_node1_id .== n^.node_id)
-- cond23 :: (NodeRead, UserRead) -> Column SqlBool
-- cond23 (n, u) = (n^.node_user_id .== user_id u)
------------------------------------------------------------------------
-- To Share a Node Team with a user, use this function
-- basically used with the invitation to a team
......
......@@ -32,13 +32,11 @@ module Gargantext.Database.Query.Facet
, FacetDocRead
, FacetPaired(..)
, FacetPairedRead
, FacetPairedReadNull
, FacetPairedReadNullAgg
, OrderBy(..)
)
where
import Control.Arrow (returnA, (>>>))
import Control.Arrow (returnA)
import Control.Lens ((^.))
import qualified Data.Text as T
import Opaleye
......@@ -95,8 +93,6 @@ viewAuthorsDoc cId _ nt = proc () -> do
, facetDoc_ngramCount = toNullable $ sqlDouble 1.0
, facetDoc_score = toNullable $ sqlDouble 1 }
--queryAuthorsDoc :: Select (NodeRead, (ContextNodeNgramsReadNull, (NgramsReadNull, (ContextNodeNgramsRead, NodeReadNull))))
--queryAuthorsDoc = leftJoin5 queryNodeTable queryContextNodeNgramsTable queryNgramsTable queryContextNodeNgramsTable queryNodeTable cond12 cond23 cond34 cond45
queryAuthorsDoc :: Select ( NodeRead
, MaybeFields ContextNodeNgramsRead
, MaybeFields NgramsRead
......@@ -114,20 +110,6 @@ queryAuthorsDoc = proc () -> do
\contact' -> justFields (_node_id contact') .=== (_cnng_context_id <$> cnn2)
returnA -< (n, cnn, ng, cnn2, contact)
-- where
-- cond12 :: (ContextNodeNgramsRead, NodeRead) -> Field SqlBool
-- cond12 (nodeNgram, doc) = _node_id doc
-- .== _cnng_context_id nodeNgram
-- cond23 :: (NgramsRead, (ContextNodeNgramsRead, NodeReadNull)) -> Field SqlBool
-- cond23 (ngrams', (nodeNgram, _)) = ngrams'^.ngrams_id
-- .== _cnng_ngrams_id nodeNgram
-- cond34 :: (ContextNodeNgramsRead, (NgramsRead, (ContextNodeNgramsReadNull, NodeReadNull))) -> Field SqlBool
-- cond34 (nodeNgram2, (ngrams', (_,_)))= ngrams'^.ngrams_id .== _cnng_ngrams_id nodeNgram2
-- cond45 :: (NodeRead, (ContextNodeNgramsRead, (NgramsReadNull, (ContextNodeNgramsReadNull, NodeReadNull)))) -> Field SqlBool
-- cond45 (contact', (nodeNgram2', (_, (_,_)))) = _node_id contact' .== _cnng_context_id nodeNgram2'
------------------------------------------------------------------------
......
......@@ -102,25 +102,6 @@ type FacetPairedRead = FacetPaired (Field SqlInt4 )
(Field SqlJsonb )
(Field SqlInt4 )
type FacetPairedReadNull = FacetPaired (FieldNullable SqlInt4)
(FieldNullable SqlTimestamptz)
(FieldNullable SqlJsonb)
(FieldNullable SqlInt4)
type FacetPairedReadNullAgg = FacetPaired (Aggregator (FieldNullable SqlInt4)
(FieldNullable SqlInt4)
)
(Aggregator (FieldNullable SqlTimestamptz)
(FieldNullable SqlTimestamptz)
)
(Aggregator (FieldNullable SqlJsonb)
(FieldNullable SqlJsonb)
)
(Aggregator (FieldNullable SqlInt4)
(FieldNullable SqlInt4)
)
......
......@@ -37,10 +37,3 @@ selectNodesWithUsername nt u = runOpaQuery $ proc () -> do
Just us -> user_username us .== sqlStrictText u
restrict -< _node_typename n .== sqlInt4 (toDBid nt)
returnA -< _node_id n
-- join' :: Select (NodeRead, UserReadNull)
-- --join' = leftJoin queryNodeTable queryUserTable on1
-- join' = optionalRestrict queryUserTable -<
-- (\(n, us) -> _node_user_id n .== user_id ud)
-- -- where
-- -- on1 (n,us) = _node_user_id n .== user_id us
......@@ -89,15 +89,6 @@ type ContextRead = ContextPoly (Field SqlInt4 )
(Field SqlText )
(Field SqlTimestamptz )
(Field SqlJsonb )
type ContextReadNull = ContextPoly (FieldNullable SqlInt4)
(FieldNullable SqlText)
(FieldNullable SqlInt4)
(FieldNullable SqlInt4)
(FieldNullable SqlInt4)
(FieldNullable SqlText)
(FieldNullable SqlTimestamptz)
(FieldNullable SqlJsonb)
------------------------------------------------------------------------
-- | Context(Read|Write)Search is slower than Context(Write|Read) use it
-- for full text search only
......@@ -124,18 +115,6 @@ type ContextSearchRead =
(Field SqlJsonb )
(Field SqlTSVector )
type ContextSearchReadNull =
ContextPolySearch
(FieldNullable SqlInt4)
(FieldNullable SqlInt4)
(FieldNullable SqlInt4)
(FieldNullable SqlInt4)
(FieldNullable SqlText)
(FieldNullable SqlTimestamptz)
(FieldNullable SqlJsonb)
(FieldNullable SqlTSVector)
data ContextPolySearch id
typename
user_id
......
......@@ -55,14 +55,6 @@ type ContextNodeNgramsRead =
(Field SqlFloat8)
(Field SqlInt4 )
type ContextNodeNgramsReadNull =
ContextNodeNgramsPoly (FieldNullable SqlInt4 )
(FieldNullable SqlInt4 )
(FieldNullable SqlInt4 )
(FieldNullable SqlInt4 )
(FieldNullable SqlFloat8)
(FieldNullable SqlInt4 )
$(makeAdaptorAndInstance "pContextNodeNgrams" ''ContextNodeNgramsPoly)
makeLenses ''ContextNodeNgramsPoly
......
......@@ -43,11 +43,6 @@ type ContextNodeNgrams2Read =
(Column SqlInt4 )
(Column SqlFloat8)
type ContextNodeNgrams2ReadNull =
ContextNodeNgrams2Poly (Column (Nullable SqlInt4 ))
(Column (Nullable SqlInt4 ))
(Column (Nullable SqlFloat8))
$(makeAdaptorAndInstance "pContextNodeNgrams2" ''ContextNodeNgrams2Poly)
makeLenses ''ContextNodeNgrams2Poly
......
......@@ -60,10 +60,6 @@ type NgramsRead = NgramsPoly (Field SqlInt4)
(Field SqlText)
(Field SqlInt4)
type NgramsReadNull = NgramsPoly (FieldNullable SqlInt4)
(FieldNullable SqlText)
(FieldNullable SqlInt4)
type NgramsDB = NgramsPoly Int Text Int
$(makeAdaptorAndInstance "pNgramsDb" ''NgramsPoly)
......
......@@ -67,14 +67,6 @@ type NgramsPosTagRead = NgramsPostagPoly (Column SqlInt4)
(Column SqlInt4)
(Column SqlInt4)
(Column SqlInt4)
type NgramsPosTagReadNull = NgramsPostagPoly (Column (Nullable SqlInt4))
(Column (Nullable SqlInt4))
(Column (Nullable SqlInt4))
(Column (Nullable SqlText))
(Column (Nullable SqlInt4))
(Column (Nullable SqlInt4))
(Column (Nullable SqlInt4))
makeLenses ''NgramsPostagPoly
instance PGS.ToRow NgramsPostagDB where
......
......@@ -89,15 +89,6 @@ type NodeRead = NodePoly (Field SqlInt4 )
(Field SqlText )
(Field SqlTimestamptz )
(Field SqlJsonb )
type NodeReadNull = NodePoly (FieldNullable SqlInt4)
(FieldNullable SqlText)
(Field SqlInt4)
(Field SqlInt4)
(FieldNullable SqlInt4)
(Field SqlText)
(FieldNullable SqlTimestamptz)
(Field SqlJsonb)
------------------------------------------------------------------------
-- | Node(Read|Write)Search is slower than Node(Write|Read) use it
-- for full text search only
......@@ -124,17 +115,6 @@ type NodeSearchRead =
(Field SqlJsonb )
(Field SqlTSVector )
type NodeSearchReadNull =
NodePolySearch
(FieldNullable SqlInt4)
(FieldNullable SqlInt4)
(FieldNullable SqlInt4)
(FieldNullable SqlInt4)
(FieldNullable SqlText)
(FieldNullable SqlTimestamptz)
(FieldNullable SqlJsonb)
(FieldNullable SqlTSVector)
data NodePolySearch id
typename
......
......@@ -46,12 +46,6 @@ type NodeContextRead = NodeContextPoly (Field SqlInt4)
(Field SqlFloat8)
(Field SqlInt4)
type NodeContextReadNull = NodeContextPoly (FieldNullable SqlInt4)
(FieldNullable SqlInt4)
(FieldNullable SqlInt4)
(FieldNullable SqlFloat8)
(FieldNullable SqlInt4)
type NodeContext = NodeContextPoly (Maybe Int) NodeId NodeId (Maybe Double) (Maybe Int)
$(makeAdaptorAndInstance "pNodeContext" ''NodeContextPoly)
......
{-|
Module : Gargantext.Database.Schema.ContextContext
Description :
Description :
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
......@@ -35,9 +35,6 @@ type NodeContext_NodeContextWrite = NodeContext_NodeContextPoly (Column (SqlInt4
type NodeContext_NodeContextRead = NodeContext_NodeContextPoly (Column (SqlInt4))
(Column (SqlInt4))
type NodeContext_NodeContextReadNull = NodeContext_NodeContextPoly (Column (Nullable SqlInt4))
(Column (Nullable SqlInt4))
type NodeContext_NodeContext = NodeContext_NodeContextPoly NodeContextId NodeContextId
$(makeAdaptorAndInstance "pNodeContext_NodeContext" ''NodeContext_NodeContextPoly)
......@@ -53,6 +50,3 @@ nodeContext_NodeContextTable =
)
queryNodeContext_NodeContextTable :: Query NodeContext_NodeContextRead
queryNodeContext_NodeContextTable = selectTable nodeContext_NodeContextTable
......@@ -68,17 +68,6 @@ type NodeNgramsRead = NodeNgramsPoly (Column SqlInt4)
(Column SqlInt4)
(Column SqlFloat8)
type NodeNgramsReadNull = NodeNgramsPoly (Column (Nullable SqlInt4))
(Column (Nullable SqlInt4))
(Column (Nullable SqlInt4))
(Column (Nullable SqlInt4))
(Column (Nullable SqlInt4))
(Column (Nullable SqlInt4))
(Column (Nullable SqlInt4))
(Column (Nullable SqlInt4))
(Column (Nullable SqlFloat8))
type NodeNgramsId = Int
type NgramsField = Int
type NgramsTag = Int
......
......@@ -40,11 +40,6 @@ type NodeNodeRead = NodeNodePoly (Field SqlInt4)
(Field SqlFloat8)
(Field SqlInt4)
type NodeNodeReadNull = NodeNodePoly (Field SqlInt4)
(Field SqlInt4)
(FieldNullable SqlFloat8)
(FieldNullable SqlInt4)
type NodeNode = NodeNodePoly NodeId NodeId (Maybe Double) (Maybe Int)
$(makeAdaptorAndInstance "pNodeNode" ''NodeNodePoly)
......
......@@ -45,13 +45,6 @@ type NodeNodeNgramsRead =
(Column SqlInt4 )
(Column SqlFloat8)
type NodeNodeNgramsReadNull =
NodeNodeNgramsPoly (Column (Nullable SqlInt4 ))
(Column (Nullable SqlInt4 ))
(Column (Nullable SqlInt4 ))
(Column (Nullable SqlInt4 ))
(Column (Nullable SqlFloat8))
type NodeNodeNgrams =
NodeNodeNgramsPoly CorpusId DocId NgramsId NgramsTypeId Double
......@@ -69,4 +62,3 @@ nodeNodeNgramsTable = Table "node_node_ngrams"
, _nnng_weight = requiredTableField "weight"
}
)
......@@ -39,11 +39,6 @@ type NodeNodeNgrams2Read =
(Column SqlInt4 )
(Column SqlFloat8)
type NodeNodeNgrams2ReadNull =
NodeNodeNgrams2Poly (Column (Nullable SqlInt4 ))
(Column (Nullable SqlInt4 ))
(Column (Nullable SqlFloat8))
type NodeNodeNgrams2 =
NodeNodeNgrams2Poly DocId NodeNgramsId Double
......@@ -58,4 +53,3 @@ nodeNodeNgrams2Table = Table "node_node_ngrams2"
, _nnng2_weight = requiredTableField "weight"
}
)
......@@ -99,14 +99,6 @@ type UserRead = UserPoly (Column SqlInt4) (Column SqlText)
(Column SqlTimestamptz)
(Column SqlText)
type UserReadNull = UserPoly (Column (Nullable SqlInt4)) (Column SqlText)
(Column (Nullable SqlTimestamptz)) (Column SqlBool)
(Column SqlText) (Column SqlText)
(Column SqlText) (Column SqlText)
(Column SqlBool) (Column SqlBool)
(Column (Nullable SqlTimestamptz))
(Column (Nullable SqlText))
type UserDB = UserPoly Int Text (Maybe UTCTime) Bool Text Text Text Text Bool Bool UTCTime (Maybe Text)
$(makeAdaptorAndInstance "pUserDB" ''UserPoly)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment