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

Hasura.RQL.Types.SchemaCache

Synopsis

Documentation

newtype MetadataResourceVersion Source #

Instances

Instances details
Eq MetadataResourceVersion Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Num MetadataResourceVersion Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Show MetadataResourceVersion Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

FromJSON MetadataResourceVersion Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

parseJSON :: Value -> Parser MetadataResourceVersion

parseJSONList :: Value -> Parser [MetadataResourceVersion]

ToJSON MetadataResourceVersion Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

data IntrospectionResult Source #

Instances

Instances details
Eq IntrospectionResult Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Show IntrospectionResult Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Generic IntrospectionResult Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Associated Types

type Rep IntrospectionResult :: Type -> Type #

Cacheable IntrospectionResult Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

type Rep IntrospectionResult Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

type Rep IntrospectionResult = D1 ('MetaData "IntrospectionResult" "Hasura.RQL.Types.SchemaCache" "graphql-engine-1.0.0-inplace" 'False) (C1 ('MetaCons "IntrospectionResult" 'PrefixI 'True) ((S1 ('MetaSel ('Just "irDoc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 RemoteSchemaIntrospection) :*: S1 ('MetaSel ('Just "irQueryRoot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Name)) :*: (S1 ('MetaSel ('Just "irMutationRoot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Name)) :*: S1 ('MetaSel ('Just "irSubscriptionRoot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Name)))))

type RemoteSchemaRelationships = InsOrdHashMap Name (InsOrdHashMap RelName (RemoteFieldInfo Name)) Source #

data RemoteSchemaCtx Source #

See fetchRemoteSchema.

Constructors

RemoteSchemaCtx 

Fields

Instances

Instances details
ToJSON RemoteSchemaCtx Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

toJSON :: RemoteSchemaCtx -> Value

toEncoding :: RemoteSchemaCtx -> Encoding

toJSONList :: [RemoteSchemaCtx] -> Value

toEncodingList :: [RemoteSchemaCtx] -> Encoding

type DepMap = HashMap SchemaObjId (HashSet SchemaDependency) Source #

newtype SchemaCacheVer Source #

Constructors

SchemaCacheVer 

Instances

Instances details
Eq SchemaCacheVer Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Ord SchemaCacheVer Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Show SchemaCacheVer Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Hashable SchemaCacheVer Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

FromJSON SchemaCacheVer Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

parseJSON :: Value -> Parser SchemaCacheVer

parseJSONList :: Value -> Parser [SchemaCacheVer]

ToJSON SchemaCacheVer Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

toJSON :: SchemaCacheVer -> Value

toEncoding :: SchemaCacheVer -> Encoding

toJSONList :: [SchemaCacheVer] -> Value

toEncodingList :: [SchemaCacheVer] -> Encoding

type InheritedRolesCache = HashMap RoleName (HashSet RoleName) Source #

askSourceInfo :: forall b m. (CacheRM m, MetadataM m, MonadError QErr m, Backend b) => SourceName -> m (SourceInfo b) Source #

Retrieves the source info for a given source name.

This function retrieves the schema cache from the monadic context, and attempts to look the corresponding source up in the source cache. This function must be used with a _type annotation_, such as `askSourceInfo @('Postgres 'Vanilla)`. It throws an error if it fails to find that source, in which case it looks that source up in the metadata, to differentiate between the source not existing or the type of the source not matching.

askSourceConfig :: forall b m. (CacheRM m, MonadError QErr m, Backend b, MetadataM m) => SourceName -> m (SourceConfig b) Source #

Retrieves the source config for a given source name.

This function relies on askSourceInfo and similarly throws an error if the source isn't found.

unsafeTableCache :: forall b. Backend b => SourceName -> SourceCache -> Maybe (TableCache b) Source #

Retrieves the table cache for a given source cache and source name.

This function must be used with a _type annotation_, such as `unsafeTableCache ('Postgres 'Vanilla)`. It returns Nothing@ if it fails to find that source or if the kind of the source does not match the type annotation, and does not distinguish between the two cases.

askTableCache :: forall b m. (Backend b, CacheRM m) => SourceName -> m (Maybe (TableCache b)) Source #

Retrieves the table cache for a given source name.

This function retrieves the schema cache from the monadic context, and attempts to look the corresponding source up in the source cache. It must be used with a _type annotation_, such as `unsafeTableCache ('Postgres 'Vanilla)`. It returns Nothing@ if it fails to find that source or if the kind of the source does not match the type annotation, and does not distinguish between the two cases.

unsafeTableInfo :: forall b. Backend b => SourceName -> TableName b -> SourceCache -> Maybe (TableInfo b) Source #

Retrieves the information about a table from the source cache, the source name, and the table name.

This function returns Nothing if it fails to find that source or if the kind of the source does not match the type annotation, and does not distinguish between the two cases.

askTableInfo :: forall b m. (QErrM m, CacheRM m, Backend b) => SourceName -> TableName b -> m (TableInfo b) Source #

Retrieves the information about a table for a given source name and table name.

This function retrieves the schema cache from the monadic context, and attempts to look the corresponding source up in the source cache. it throws an error if it fails to find that source, in which case it looks that source up in the metadata, to differentiate between the source not existing or the type of the source not matching.

askTableCoreInfo :: forall b m. (QErrM m, CacheRM m, Backend b) => SourceName -> TableName b -> m (TableCoreInfo b) Source #

Similar to askTableInfo, but drills further down to extract the underlying core info.

askTableFieldInfoMap :: forall b m. (QErrM m, CacheRM m, Backend b) => SourceName -> TableName b -> m (FieldInfoMap (FieldInfo b)) Source #

Similar to askTableCoreInfo, but drills further down to extract the underlying field info map.

askTableMetadata :: forall b m. (QErrM m, MetadataM m, Backend b) => SourceName -> TableName b -> m (TableMetadata b) Source #

Retrieves the metadata information about a table for a given source name and table name.

Unlike most other ask functions in this module, this function does not drill through the schema cache, and instead inspects the metadata. Like most others, it throws an error if it fails to find that source, in which case it looks that source up in the metadata, to differentiate between the source not existing or the type of the source not matching.

unsafeFunctionCache :: forall b. Backend b => SourceName -> SourceCache -> Maybe (FunctionCache b) Source #

Retrieves the function cache for a given source cache and source name.

This function must be used with a _type annotation_, such as `unsafeFunctionCache ('Postgres 'Vanilla)`. It returns Nothing@ if it fails to find that source or if the kind of the source does not match the type annotation, and does not distinguish between the two cases.

unsafeFunctionInfo :: forall b. Backend b => SourceName -> FunctionName b -> SourceCache -> Maybe (FunctionInfo b) Source #

Retrieves the information about a function from the source cache, the source name, and the function name.

This function returns Nothing if it fails to find that source or if the kind of the source does not match the type annotation, and does not distinguish between the two cases.

askFunctionInfo :: forall b m. (QErrM m, CacheRM m, Backend b) => SourceName -> FunctionName b -> m (FunctionInfo b) Source #

Retrieves the information about a function cache for a given source name and function name.

This function retrieves the schema cache from the monadic context, and attempts to look the corresponding source up in the source cache. It throws an error if it fails to find that source, in which case it looks that source up in the metadata, to differentiate between the source not existing or the type of the source not matching.

newtype SourceT m a Source #

Constructors

SourceT 

Fields

Instances

Instances details
MonadTrans SourceT Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

lift :: Monad m => m a -> SourceT m a #

MonadWriter w m => MonadWriter w (SourceT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

writer :: (a, w) -> SourceT m a #

tell :: w -> SourceT m () #

listen :: SourceT m a -> SourceT m (a, w) #

pass :: SourceT m (a, w -> w) -> SourceT m a #

MonadState s m => MonadState s (SourceT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

get :: SourceT m s #

put :: s -> SourceT m () #

state :: (s -> (a, s)) -> SourceT m a #

MonadError e m => MonadError e (SourceT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

throwError :: e -> SourceT m a #

catchError :: SourceT m a -> (e -> SourceT m a) -> SourceT m a #

TableCoreInfoRM b m => TableCoreInfoRM b (SourceT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Monad m => Monad (SourceT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

(>>=) :: SourceT m a -> (a -> SourceT m b) -> SourceT m b #

(>>) :: SourceT m a -> SourceT m b -> SourceT m b #

return :: a -> SourceT m a #

Functor m => Functor (SourceT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

fmap :: (a -> b) -> SourceT m a -> SourceT m b #

(<$) :: a -> SourceT m b -> SourceT m a #

Applicative m => Applicative (SourceT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

pure :: a -> SourceT m a #

(<*>) :: SourceT m (a -> b) -> SourceT m a -> SourceT m b #

liftA2 :: (a -> b -> c) -> SourceT m a -> SourceT m b -> SourceT m c #

(*>) :: SourceT m a -> SourceT m b -> SourceT m b #

(<*) :: SourceT m a -> SourceT m b -> SourceT m a #

MonadIO m => MonadIO (SourceT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

liftIO :: IO a -> SourceT m a #

MonadTx m => MonadTx (SourceT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

liftTx :: TxE QErr a -> SourceT m a Source #

CacheRM m => CacheRM (SourceT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Monad m => SourceM (SourceT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

class SourceM m => TableCoreInfoRM b m where Source #

A more limited version of CacheRM that is used when building the schema cache, since the entire schema cache has not been built yet.

Instances

Instances details
TableCoreInfoRM b m => TableCoreInfoRM b (SourceT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

TableCoreInfoRM b m => TableCoreInfoRM b (TraceT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

TableCoreInfoRM b m => TableCoreInfoRM b (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

(Monad m, Backend b) => TableCoreInfoRM b (TableCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

(MonadDepend m, Backend b) => TableCoreInfoRM b (TableCoreCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

(Monoid w, TableCoreInfoRM b m) => TableCoreInfoRM b (WriterT w m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

TableCoreInfoRM b m => TableCoreInfoRM b (StateT s m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

TableCoreInfoRM b m => TableCoreInfoRM b (ReaderT r m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

newtype TableCoreCacheRT b m a Source #

Instances

Instances details
MonadWriter w m => MonadWriter w (TableCoreCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

writer :: (a, w) -> TableCoreCacheRT b m a #

tell :: w -> TableCoreCacheRT b m () #

listen :: TableCoreCacheRT b m a -> TableCoreCacheRT b m (a, w) #

pass :: TableCoreCacheRT b m (a, w -> w) -> TableCoreCacheRT b m a #

MonadState s m => MonadState s (TableCoreCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

get :: TableCoreCacheRT b m s #

put :: s -> TableCoreCacheRT b m () #

state :: (s -> (a, s)) -> TableCoreCacheRT b m a #

MonadReader r m => MonadReader r (TableCoreCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

ask :: TableCoreCacheRT b m r #

local :: (r -> r) -> TableCoreCacheRT b m a -> TableCoreCacheRT b m a #

reader :: (r -> a) -> TableCoreCacheRT b m a #

MonadError e m => MonadError e (TableCoreCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

throwError :: e -> TableCoreCacheRT b m a #

catchError :: TableCoreCacheRT b m a -> (e -> TableCoreCacheRT b m a) -> TableCoreCacheRT b m a #

(MonadDepend m, Backend b) => TableCoreInfoRM b (TableCoreCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

MonadTrans (TableCoreCacheRT b) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

lift :: Monad m => m a -> TableCoreCacheRT b m a #

Monad m => Monad (TableCoreCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

(>>=) :: TableCoreCacheRT b m a -> (a -> TableCoreCacheRT b m b0) -> TableCoreCacheRT b m b0 #

(>>) :: TableCoreCacheRT b m a -> TableCoreCacheRT b m b0 -> TableCoreCacheRT b m b0 #

return :: a -> TableCoreCacheRT b m a #

Functor m => Functor (TableCoreCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

fmap :: (a -> b0) -> TableCoreCacheRT b m a -> TableCoreCacheRT b m b0 #

(<$) :: a -> TableCoreCacheRT b m b0 -> TableCoreCacheRT b m a #

Applicative m => Applicative (TableCoreCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

pure :: a -> TableCoreCacheRT b m a #

(<*>) :: TableCoreCacheRT b m (a -> b0) -> TableCoreCacheRT b m a -> TableCoreCacheRT b m b0 #

liftA2 :: (a -> b0 -> c) -> TableCoreCacheRT b m a -> TableCoreCacheRT b m b0 -> TableCoreCacheRT b m c #

(*>) :: TableCoreCacheRT b m a -> TableCoreCacheRT b m b0 -> TableCoreCacheRT b m b0 #

(<*) :: TableCoreCacheRT b m a -> TableCoreCacheRT b m b0 -> TableCoreCacheRT b m a #

MonadIO m => MonadIO (TableCoreCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

liftIO :: IO a -> TableCoreCacheRT b m a #

MonadTx m => MonadTx (TableCoreCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

liftTx :: TxE QErr a -> TableCoreCacheRT b m a Source #

Monad m => SourceM (TableCoreCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

class TableCoreInfoRM b m => TableInfoRM b m where Source #

All our RQL DML queries operate over a single source. This typeclass facilitates that.

Instances

Instances details
TableInfoRM b m => TableInfoRM b (TraceT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

(Monad m, Backend b) => TableInfoRM b (TableCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

(Monoid w, TableInfoRM b m) => TableInfoRM b (WriterT w m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

TableInfoRM b m => TableInfoRM b (StateT s m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

TableInfoRM b m => TableInfoRM b (ReaderT r m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

newtype TableCacheRT b m a Source #

Constructors

TableCacheRT 

Fields

Instances

Instances details
MonadWriter w m => MonadWriter w (TableCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

writer :: (a, w) -> TableCacheRT b m a #

tell :: w -> TableCacheRT b m () #

listen :: TableCacheRT b m a -> TableCacheRT b m (a, w) #

pass :: TableCacheRT b m (a, w -> w) -> TableCacheRT b m a #

MonadState s m => MonadState s (TableCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

get :: TableCacheRT b m s #

put :: s -> TableCacheRT b m () #

state :: (s -> (a, s)) -> TableCacheRT b m a #

MonadError e m => MonadError e (TableCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

throwError :: e -> TableCacheRT b m a #

catchError :: TableCacheRT b m a -> (e -> TableCacheRT b m a) -> TableCacheRT b m a #

(Monad m, Backend b) => TableInfoRM b (TableCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

(Monad m, Backend b) => TableCoreInfoRM b (TableCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

MonadTrans (TableCacheRT b) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

lift :: Monad m => m a -> TableCacheRT b m a #

Monad m => Monad (TableCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

(>>=) :: TableCacheRT b m a -> (a -> TableCacheRT b m b0) -> TableCacheRT b m b0 #

(>>) :: TableCacheRT b m a -> TableCacheRT b m b0 -> TableCacheRT b m b0 #

return :: a -> TableCacheRT b m a #

Functor m => Functor (TableCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

fmap :: (a -> b0) -> TableCacheRT b m a -> TableCacheRT b m b0 #

(<$) :: a -> TableCacheRT b m b0 -> TableCacheRT b m a #

Applicative m => Applicative (TableCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

pure :: a -> TableCacheRT b m a #

(<*>) :: TableCacheRT b m (a -> b0) -> TableCacheRT b m a -> TableCacheRT b m b0 #

liftA2 :: (a -> b0 -> c) -> TableCacheRT b m a -> TableCacheRT b m b0 -> TableCacheRT b m c #

(*>) :: TableCacheRT b m a -> TableCacheRT b m b0 -> TableCacheRT b m b0 #

(<*) :: TableCacheRT b m a -> TableCacheRT b m b0 -> TableCacheRT b m a #

MonadIO m => MonadIO (TableCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

liftIO :: IO a -> TableCacheRT b m a #

UserInfoM m => UserInfoM (TableCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

HasServerConfigCtx m => HasServerConfigCtx (TableCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

MonadTx m => MonadTx (TableCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

Methods

liftTx :: TxE QErr a -> TableCacheRT b m a Source #

Monad m => SourceM (TableCacheRT b m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

class Monad m => CacheRM m where Source #

Instances

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

Defined in Hasura.RQL.Types.SchemaCache

CacheRM m => CacheRM (SourceT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

CacheRM m => CacheRM (MetadataT m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache.Build

Monad m => CacheRM (CacheRWT m) Source # 
Instance details

Defined in Hasura.RQL.DDL.Schema.Cache

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

Defined in Hasura.RQL.Types.SchemaCache

CacheRM m => CacheRM (StateT s m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

(Monoid w, CacheRM m) => CacheRM (WriterT w m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

CacheRM m => CacheRM (TxET e m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

CacheRM m => CacheRM (TxET QErr m) Source # 
Instance details

Defined in Hasura.RQL.Types.SchemaCache

getRemoteDependencies :: SchemaCache -> SourceName -> [SchemaObjId] Source #

Compute all remote dependencies on a source.

Given a source name, this function computes all of its dependencies, direct or indirect, and returns all of the dependencies that are not "local" to the source, i.e. that belong to another source or to a remote schema, here dubbed "remote dependencies".

This functions returns a SchemaObjId for each such dependency, but makes no attempt at extracting the underlying SourceObjId (if any), for two reasons: 1. a SourceObjId no longer contains the source name, which most callers need to identify where the corresponding dependency is 2. this would prevent us from returning remote schema dependencies, which by definition do not have a corresponding SourceObjId

getBoolExpDeps :: forall b. GetAggregationPredicatesDeps b => SourceName -> TableName b -> AnnBoolExpPartialSQL b -> [SchemaDependency] Source #

Discover the schema dependencies of an AnnBoolExpPartialSQL.

askFieldInfoMapSource :: (QErrM m, Backend b, TableCoreInfoRM b m) => TableName b -> m (FieldInfoMap (FieldInfo b)) Source #

Asking for a table's fields info without explicit SourceName argument. The source name is implicitly inferred from SourceM via @TableCoreInfoRM.