]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Queries/Filter.hs
[NGRAMS] Add Versioned to the API and implement tableNgramsPatch
[gargantext.git] / src / Gargantext / Database / Queries / Filter.hs
1 {-|
2 Module : Gargantext.Database.Queries.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.Queries.Filter where
23
24 import Gargantext.Core.Types (Limit, Offset)
25 import Data.Maybe (Maybe, maybe)
26 import Opaleye (Query, limit, offset)
27
28 limit' :: Maybe Limit -> Query a -> Query a
29 limit' maybeLimit query = maybe query (\l -> limit l query) maybeLimit
30
31 offset' :: Maybe Offset -> Query a -> Query a
32 offset' maybeOffset query = maybe query (\o -> offset o query) maybeOffset
33
34