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

Hasura.GraphQL.Schema.Table

Description

Helper functions for generating the schema of database tables

Synopsis

Documentation

getTableGQLName :: forall b m. (Backend b, MonadError QErr m) => TableInfo b -> m Name Source #

Helper function to get the table GraphQL name. A table may have a custom name configured with it. When the custom name exists, the GraphQL nodes that are generated according to the custom name. For example: Let's say, we have a table called `users address`, the name of the table is not GraphQL compliant so we configure the table with a GraphQL compliant name, say users_address The generated top-level nodes of this table will be like users_address, insert_users_address etc

getTableIdentifierName :: forall b m. (Backend b, MonadError QErr m) => TableInfo b -> m GQLNameIdentifier Source #

similar to getTableGQLName but returns table name as a list with name pieces instead of concatenating schema and table name together.

tableSelectColumnsEnum :: forall b r m n. (Backend b, MonadBuildSchemaBase r m n) => SourceInfo b -> TableInfo b -> m (Maybe (Parser 'Both n (Column b))) Source #

Table select columns enum

Parser for an enum type that matches the columns of the given table. Used as a parameter for "distinct", among others. Maps to the table_select_column object.

Return Nothing if there's no column the current user has "select" permissions for.

tableSelectColumnsPredEnum :: forall b r m n. MonadBuildSchema b r m n => (ColumnType b -> Bool) -> Name -> SourceInfo b -> TableInfo b -> m (Maybe (Parser 'Both n (Column b))) Source #

Table select columns enum of a certain type.

Parser for an enum type that matches, of a given table, certain columns which satisfy a predicate. Used as a parameter for aggregation predicate arguments, among others. Maps to the table_select_column object.

Return Nothing if there's no column the current user has "select" permissions for.

tableUpdateColumnsEnum :: forall b r m n. MonadBuildSchema b r m n => TableInfo b -> m (Maybe (Parser 'Both n (Column b))) Source #

Table update columns enum

Parser for an enum type that matches the columns of the given table. Used for conflict resolution in "insert" mutations, among others. Maps to the table_update_column object.

updateColumnsPlaceholderParser :: MonadBuildSchema backend r m n => TableInfo backend -> m (Parser 'Both n (Maybe (Column backend))) Source #

tableSelectFields :: forall b r m. (Backend b, MonadError QErr m, MonadReader r m, Has SchemaContext r) => SourceInfo b -> TableInfo b -> m [FieldInfo b] Source #

tableColumns :: forall b. TableInfo b -> [ColumnInfo b] Source #

tableSelectColumns :: forall b r m. (Backend b, MonadError QErr m, MonadReader r m, Has SchemaContext r) => SourceInfo b -> TableInfo b -> m [ColumnInfo b] Source #

Get the columns of a table that my be selected under the given select permissions.

tableUpdateColumns :: forall b. Backend b => RoleName -> TableInfo b -> [ColumnInfo b] Source #

Get the columns of a table that my be updated under the given update permissions.