graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellNone
LanguageHaskell2010

Hasura.NativeQuery.InterpolatedQuery

Description

Parser and prettyprinter for native query code.

Synopsis

Documentation

data InterpolatedItem variable Source #

A component of an interpolated query

Constructors

IIText Text

normal text

IIVariable variable

a captured variable

Instances

Instances details
Foldable InterpolatedItem Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Methods

fold :: Monoid m => InterpolatedItem m -> m #

foldMap :: Monoid m => (a -> m) -> InterpolatedItem a -> m #

foldMap' :: Monoid m => (a -> m) -> InterpolatedItem a -> m #

foldr :: (a -> b -> b) -> b -> InterpolatedItem a -> b #

foldr' :: (a -> b -> b) -> b -> InterpolatedItem a -> b #

foldl :: (b -> a -> b) -> b -> InterpolatedItem a -> b #

foldl' :: (b -> a -> b) -> b -> InterpolatedItem a -> b #

foldr1 :: (a -> a -> a) -> InterpolatedItem a -> a #

foldl1 :: (a -> a -> a) -> InterpolatedItem a -> a #

toList :: InterpolatedItem a -> [a] #

null :: InterpolatedItem a -> Bool #

length :: InterpolatedItem a -> Int #

elem :: Eq a => a -> InterpolatedItem a -> Bool #

maximum :: Ord a => InterpolatedItem a -> a #

minimum :: Ord a => InterpolatedItem a -> a #

sum :: Num a => InterpolatedItem a -> a #

product :: Num a => InterpolatedItem a -> a #

Traversable InterpolatedItem Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Methods

traverse :: Applicative f => (a -> f b) -> InterpolatedItem a -> f (InterpolatedItem b) #

sequenceA :: Applicative f => InterpolatedItem (f a) -> f (InterpolatedItem a) #

mapM :: Monad m => (a -> m b) -> InterpolatedItem a -> m (InterpolatedItem b) #

sequence :: Monad m => InterpolatedItem (m a) -> m (InterpolatedItem a) #

Functor InterpolatedItem Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Methods

fmap :: (a -> b) -> InterpolatedItem a -> InterpolatedItem b #

(<$) :: a -> InterpolatedItem b -> InterpolatedItem a #

Lift variable => Lift (InterpolatedItem variable :: Type) Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Methods

lift :: Quote m => InterpolatedItem variable -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => InterpolatedItem variable -> Code m (InterpolatedItem variable) #

Data variable => Data (InterpolatedItem variable) Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> InterpolatedItem variable -> c (InterpolatedItem variable) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (InterpolatedItem variable) #

toConstr :: InterpolatedItem variable -> Constr #

dataTypeOf :: InterpolatedItem variable -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (InterpolatedItem variable)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (InterpolatedItem variable)) #

gmapT :: (forall b. Data b => b -> b) -> InterpolatedItem variable -> InterpolatedItem variable #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> InterpolatedItem variable -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> InterpolatedItem variable -> r #

gmapQ :: (forall d. Data d => d -> u) -> InterpolatedItem variable -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> InterpolatedItem variable -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> InterpolatedItem variable -> m (InterpolatedItem variable) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> InterpolatedItem variable -> m (InterpolatedItem variable) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> InterpolatedItem variable -> m (InterpolatedItem variable) #

Generic (InterpolatedItem variable) Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Associated Types

type Rep (InterpolatedItem variable) :: Type -> Type #

Methods

from :: InterpolatedItem variable -> Rep (InterpolatedItem variable) x #

to :: Rep (InterpolatedItem variable) x -> InterpolatedItem variable #

Show variable => Show (InterpolatedItem variable) Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Methods

showsPrec :: Int -> InterpolatedItem variable -> ShowS #

show :: InterpolatedItem variable -> String #

showList :: [InterpolatedItem variable] -> ShowS #

NFData variable => NFData (InterpolatedItem variable) Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Methods

rnf :: InterpolatedItem variable -> () #

Eq variable => Eq (InterpolatedItem variable) Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Methods

(==) :: InterpolatedItem variable -> InterpolatedItem variable -> Bool #

(/=) :: InterpolatedItem variable -> InterpolatedItem variable -> Bool #

Ord variable => Ord (InterpolatedItem variable) Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Methods

compare :: InterpolatedItem variable -> InterpolatedItem variable -> Ordering #

(<) :: InterpolatedItem variable -> InterpolatedItem variable -> Bool #

(<=) :: InterpolatedItem variable -> InterpolatedItem variable -> Bool #

(>) :: InterpolatedItem variable -> InterpolatedItem variable -> Bool #

(>=) :: InterpolatedItem variable -> InterpolatedItem variable -> Bool #

max :: InterpolatedItem variable -> InterpolatedItem variable -> InterpolatedItem variable #

min :: InterpolatedItem variable -> InterpolatedItem variable -> InterpolatedItem variable #

Hashable variable => Hashable (InterpolatedItem variable) Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Methods

hashWithSalt :: Int -> InterpolatedItem variable -> Int Source #

hash :: InterpolatedItem variable -> Int Source #

type Rep (InterpolatedItem variable) Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

type Rep (InterpolatedItem variable) = D1 ('MetaData "InterpolatedItem" "Hasura.NativeQuery.InterpolatedQuery" "graphql-engine-1.0.0-inplace" 'False) (C1 ('MetaCons "IIText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "IIVariable" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 variable)))

newtype InterpolatedQuery variable Source #

A list of stored procedure components representing a single stored procedure, separating the variables from the text.

Constructors

InterpolatedQuery 

Instances

Instances details
Foldable InterpolatedQuery Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Methods

fold :: Monoid m => InterpolatedQuery m -> m #

foldMap :: Monoid m => (a -> m) -> InterpolatedQuery a -> m #

foldMap' :: Monoid m => (a -> m) -> InterpolatedQuery a -> m #

foldr :: (a -> b -> b) -> b -> InterpolatedQuery a -> b #

foldr' :: (a -> b -> b) -> b -> InterpolatedQuery a -> b #

foldl :: (b -> a -> b) -> b -> InterpolatedQuery a -> b #

foldl' :: (b -> a -> b) -> b -> InterpolatedQuery a -> b #

foldr1 :: (a -> a -> a) -> InterpolatedQuery a -> a #

foldl1 :: (a -> a -> a) -> InterpolatedQuery a -> a #

toList :: InterpolatedQuery a -> [a] #

null :: InterpolatedQuery a -> Bool #

length :: InterpolatedQuery a -> Int #

elem :: Eq a => a -> InterpolatedQuery a -> Bool #

maximum :: Ord a => InterpolatedQuery a -> a #

minimum :: Ord a => InterpolatedQuery a -> a #

sum :: Num a => InterpolatedQuery a -> a #

product :: Num a => InterpolatedQuery a -> a #

Traversable InterpolatedQuery Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Methods

traverse :: Applicative f => (a -> f b) -> InterpolatedQuery a -> f (InterpolatedQuery b) #

sequenceA :: Applicative f => InterpolatedQuery (f a) -> f (InterpolatedQuery a) #

mapM :: Monad m => (a -> m b) -> InterpolatedQuery a -> m (InterpolatedQuery b) #

sequence :: Monad m => InterpolatedQuery (m a) -> m (InterpolatedQuery a) #

Functor InterpolatedQuery Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Lift variable => Lift (InterpolatedQuery variable :: Type) Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Methods

lift :: Quote m => InterpolatedQuery variable -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => InterpolatedQuery variable -> Code m (InterpolatedQuery variable) #

v ~ ArgumentName => ToJSON (InterpolatedQuery v) Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

v ~ ArgumentName => HasCodec (InterpolatedQuery v) Source #

We store the interpolated query as the user text and parse it back when converting back to Haskell code.

Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Data variable => Data (InterpolatedQuery variable) Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> InterpolatedQuery variable -> c (InterpolatedQuery variable) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (InterpolatedQuery variable) #

toConstr :: InterpolatedQuery variable -> Constr #

dataTypeOf :: InterpolatedQuery variable -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (InterpolatedQuery variable)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (InterpolatedQuery variable)) #

gmapT :: (forall b. Data b => b -> b) -> InterpolatedQuery variable -> InterpolatedQuery variable #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> InterpolatedQuery variable -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> InterpolatedQuery variable -> r #

gmapQ :: (forall d. Data d => d -> u) -> InterpolatedQuery variable -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> InterpolatedQuery variable -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> InterpolatedQuery variable -> m (InterpolatedQuery variable) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> InterpolatedQuery variable -> m (InterpolatedQuery variable) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> InterpolatedQuery variable -> m (InterpolatedQuery variable) #

Generic (InterpolatedQuery variable) Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Associated Types

type Rep (InterpolatedQuery variable) :: Type -> Type #

Methods

from :: InterpolatedQuery variable -> Rep (InterpolatedQuery variable) x #

to :: Rep (InterpolatedQuery variable) x -> InterpolatedQuery variable #

Show variable => Show (InterpolatedQuery variable) Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Methods

showsPrec :: Int -> InterpolatedQuery variable -> ShowS #

show :: InterpolatedQuery variable -> String #

showList :: [InterpolatedQuery variable] -> ShowS #

NFData variable => NFData (InterpolatedQuery variable) Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Methods

rnf :: InterpolatedQuery variable -> () #

Eq variable => Eq (InterpolatedQuery variable) Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Methods

(==) :: InterpolatedQuery variable -> InterpolatedQuery variable -> Bool #

(/=) :: InterpolatedQuery variable -> InterpolatedQuery variable -> Bool #

Ord variable => Ord (InterpolatedQuery variable) Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Methods

compare :: InterpolatedQuery variable -> InterpolatedQuery variable -> Ordering #

(<) :: InterpolatedQuery variable -> InterpolatedQuery variable -> Bool #

(<=) :: InterpolatedQuery variable -> InterpolatedQuery variable -> Bool #

(>) :: InterpolatedQuery variable -> InterpolatedQuery variable -> Bool #

(>=) :: InterpolatedQuery variable -> InterpolatedQuery variable -> Bool #

max :: InterpolatedQuery variable -> InterpolatedQuery variable -> InterpolatedQuery variable #

min :: InterpolatedQuery variable -> InterpolatedQuery variable -> InterpolatedQuery variable #

Hashable variable => Hashable (InterpolatedQuery variable) Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

Methods

hashWithSalt :: Int -> InterpolatedQuery variable -> Int Source #

hash :: InterpolatedQuery variable -> Int Source #

type Rep (InterpolatedQuery variable) Source # 
Instance details

Defined in Hasura.NativeQuery.InterpolatedQuery

type Rep (InterpolatedQuery variable) = Rep [InterpolatedItem variable]

parseInterpolatedQuery :: Text -> Either Text (InterpolatedQuery ArgumentName) Source #

extract all of the `{{ variable }}` inside our query string

getUniqueVariables :: Ord var => InterpolatedQuery var -> Set var Source #

Get a set of all arguments used in an interpolated query.

trimQueryEnd :: InterpolatedQuery var -> InterpolatedQuery var Source #

Remove spaces and semicolon from the end of a query and add a newline, for sql backends.