2 Module : Gargantext.Database.Query.Filter
3 Description : Main requests of Node to the database
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
11 {-# OPTIONS_GHC -fno-warn-name-shadowing #-}
13 {-# LANGUAGE Arrows #-}
14 {-# LANGUAGE DeriveGeneric #-}
15 {-# LANGUAGE FlexibleInstances #-}
16 {-# LANGUAGE FunctionalDependencies #-}
17 {-# LANGUAGE MultiParamTypeClasses #-}
18 {-# LANGUAGE NoImplicitPrelude #-}
19 {-# LANGUAGE TemplateHaskell #-}
20 {-# OPTIONS_GHC -fno-warn-orphans #-}
22 module Gargantext.Database.Query.Filter
25 import Gargantext.Core.Types (Limit, Offset)
26 import Data.Maybe (Maybe, maybe)
27 import Opaleye (Query, limit, offset)
29 limit' :: Maybe Limit -> Query a -> Query a
30 limit' maybeLimit query = maybe query (\l -> limit l query) maybeLimit
32 offset' :: Maybe Offset -> Query a -> Query a
33 offset' maybeOffset query = maybe query (\o -> offset o query) maybeOffset