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

Hasura.GraphQL.Transport.HTTP

Description

Execution of GraphQL queries over HTTP transport

Synopsis

Documentation

data QueryCacheKey Source #

Instances

Instances details
ToJSON QueryCacheKey Source # 
Instance details

Defined in Hasura.GraphQL.Transport.HTTP

Methods

toJSON :: QueryCacheKey -> Value

toEncoding :: QueryCacheKey -> Encoding

toJSONList :: [QueryCacheKey] -> Value

toEncodingList :: [QueryCacheKey] -> Encoding

class Monad m => MonadExecuteQuery m where Source #

Minimal complete definition

Nothing

Methods

cacheLookup Source #

Arguments

:: [RemoteSchemaInfo]

Used to check if the elaborated query supports caching

-> [ActionsInfo]

Used to check if actions query supports caching (unsupported if forward_client_headers is set)

-> QueryCacheKey

Key that uniquely identifies the result of a query execution

-> Maybe CachedDirective

Cached Directive from GraphQL query AST

-> TraceT (ExceptT QErr m) (ResponseHeaders, Maybe EncJSON)

HTTP headers to be sent back to the caller for this GraphQL request, containing e.g. time-to-live information, and a cached value if found and within time-to-live. So a return value (non-empty-ttl-headers, Nothing) represents that we don't have a server-side cache of the query, but that the client should store it locally. The value ([], Just json) represents that the client should not store the response locally, but we do have a server-side cache value that can be used to avoid query execution.

This method does two things: it looks up a query result in the server-side cache, if a cache is used, and it additionally returns HTTP headers that can instruct a client how long a response can be cached locally (i.e. client-side).

cacheStore Source #

Arguments

:: QueryCacheKey

Key under which to store the result of a query execution

-> Maybe CachedDirective

Cached Directive from GraphQL query AST

-> EncJSON

Result of a query execution

-> TraceT (ExceptT QErr m) CacheStoreResponse

Always succeeds

Store a json response for a query that we've executed in the cache. Note that, as part of this, cacheStore has to decide whether the response is cacheable. A very similar decision is also made in cacheLookup, since it has to construct corresponding cache-enabling headers that are sent to the client. But note that the HTTP headers influence client-side caching, whereas cacheStore changes the server-side cache.

Instances

Instances details
MonadExecuteQuery m => MonadExecuteQuery (TraceT m) Source # 
Instance details

Defined in Hasura.GraphQL.Transport.HTTP

MonadExecuteQuery m => MonadExecuteQuery (MetadataStorageT m) Source # 
Instance details

Defined in Hasura.GraphQL.Transport.HTTP

Monad m => MonadExecuteQuery (PGMetadataStorageAppT m) Source # 
Instance details

Defined in Hasura.App

MonadExecuteQuery m => MonadExecuteQuery (ExceptT r m) Source # 
Instance details

Defined in Hasura.GraphQL.Transport.HTTP

MonadExecuteQuery m => MonadExecuteQuery (ReaderT r m) Source # 
Instance details

Defined in Hasura.GraphQL.Transport.HTTP

data AnnotatedResponsePart Source #

A partial response, e.g. from a remote schema call or postgres postgres query, which we'll assemble into the final response for the client. It is annotated with timing metadata.

Constructors

AnnotatedResponsePart 

Fields

data AnnotatedResponse Source #

A full response, annotated with timing metadata.

buildResponseFromParts :: MonadError QErr m => QueryType -> Either (Either GQExecError QErr) (RootFieldMap AnnotatedResponsePart) -> ResponseHeaders -> m AnnotatedResponse Source #

Merge response parts into a full response.

newtype SessVarPred Source #

A predicate on session variables. The Monoid instance makes it simple to combine several predicates disjunctively. | The definition includes Maybe which allows us to short-circuit calls like mempty <> m and m <> mempty, which otherwise might build up long repeated chains of calls to _ _ -> False.

runGQBatched Source #

Run (execute) a batched GraphQL query (see GQLBatchedReqs).