graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellSafe-Inferred
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. MonadBuildSchema b r m n => TableInfo b -> SchemaT r m (Maybe (Parser 'Both n (Column b, AnnRedactionExpUnpreparedValue 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) -> GQLNameIdentifier -> TableInfo b -> SchemaT r 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 -> SchemaT r 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.

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

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

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

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

Get the computed fields of a table that may 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.