]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Query/Filter.hs
[REPL sugar] runCmdReplEasy
[gargantext.git] / src / Gargantext / Database / Query / Filter.hs
1 {-|
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
8 Portability : POSIX
9 -}
10
11 {-# OPTIONS_GHC -fno-warn-name-shadowing #-}
12
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 #-}
21
22 module Gargantext.Database.Query.Filter
23 where
24
25 import Gargantext.Core.Types (Limit, Offset)
26 import Data.Maybe (Maybe, maybe)
27 import Opaleye (Query, limit, offset)
28
29 limit' :: Maybe Limit -> Query a -> Query a
30 limit' maybeLimit query = maybe query (\l -> limit l query) maybeLimit
31
32 offset' :: Maybe Offset -> Query a -> Query a
33 offset' maybeOffset query = maybe query (\o -> offset o query) maybeOffset
34
35