Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- insertIntoTable :: forall b r m n. MonadBuildSchema b r m n => BackendTableSelectSchema b => (SourceInfo b -> TableInfo b -> m (InputFieldsParser n (BackendInsert b (UnpreparedValue b)))) -> Scenario -> SourceInfo b -> TableInfo b -> Name -> Maybe Description -> m (Maybe (FieldParser n (AnnotatedInsert b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b))))
- insertOneIntoTable :: forall b r m n. MonadBuildSchema b r m n => BackendTableSelectSchema b => (SourceInfo b -> TableInfo b -> m (InputFieldsParser n (BackendInsert b (UnpreparedValue b)))) -> Scenario -> SourceInfo b -> TableInfo b -> Name -> Maybe Description -> m (Maybe (FieldParser n (AnnotatedInsert b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b))))
- tableFieldsInput :: forall b r m n. MonadBuildSchema b r m n => SourceInfo b -> TableInfo b -> m (Parser 'Input n (AnnotatedInsertRow b (UnpreparedValue b)))
- mkDefaultRelationshipParser :: forall b r m n. MonadBuildSchema b r m n => (SourceInfo b -> TableInfo b -> m (InputFieldsParser n (BackendInsert b (UnpreparedValue b)))) -> XNestedInserts b -> SourceInfo b -> RelInfo b -> m (Maybe (InputFieldsParser n (Maybe (AnnotatedInsertField b (UnpreparedValue b)))))
- objectRelationshipInput :: forall b r m n. MonadBuildSchema b r m n => (SourceInfo b -> TableInfo b -> m (InputFieldsParser n (BackendInsert b (UnpreparedValue b)))) -> SourceInfo b -> TableInfo b -> m (Maybe (Parser 'Input n (SingleObjectInsert b (UnpreparedValue b))))
- arrayRelationshipInput :: forall b r m n. MonadBuildSchema b r m n => (SourceInfo b -> TableInfo b -> m (InputFieldsParser n (BackendInsert b (UnpreparedValue b)))) -> SourceInfo b -> TableInfo b -> m (Maybe (Parser 'Input n (MultiObjectInsert b (UnpreparedValue b))))
- mkInsertObject :: forall b f. BackendSchema b => f (AnnotatedInsertRow b (UnpreparedValue b)) -> TableInfo b -> BackendInsert b (UnpreparedValue b) -> InsPermInfo b -> Maybe (UpdPermInfo b) -> AnnotatedInsertData b f (UnpreparedValue b)
- deleteFromTable :: forall b r m n. (MonadBuildSchema b r m n, AggregationPredicatesSchema b, BackendTableSelectSchema b) => Scenario -> SourceInfo b -> TableInfo b -> Name -> Maybe Description -> m (Maybe (FieldParser n (AnnDelG b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b))))
- deleteFromTableByPk :: forall b r m n. MonadBuildSchema b r m n => BackendTableSelectSchema b => Scenario -> SourceInfo b -> TableInfo b -> Name -> Maybe Description -> m (Maybe (FieldParser n (AnnDelG b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b))))
- mkDeleteObject :: Backend b => TableName b -> [ColumnInfo b] -> DelPermInfo b -> Maybe NamingCase -> (AnnBoolExp b (UnpreparedValue b), MutationOutputG b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b)) -> AnnDelG b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b)
- mutationSelectionSet :: forall b r m n. MonadBuildSchema b r m n => BackendTableSelectSchema b => SourceInfo b -> TableInfo b -> m (Parser 'Output n (MutFldsG b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b)))
- primaryKeysArguments :: forall b r m n. MonadBuildSchema b r m n => TableInfo b -> m (Maybe (InputFieldsParser n (AnnBoolExp b (UnpreparedValue b))))
Documentation
:: forall b r m n. MonadBuildSchema b r m n | |
=> BackendTableSelectSchema b | |
=> (SourceInfo b -> TableInfo b -> m (InputFieldsParser n (BackendInsert b (UnpreparedValue b)))) | |
-> Scenario | |
-> SourceInfo b | |
-> TableInfo b | qualified name of the table |
-> Name | field display name |
-> Maybe Description | field description, if any |
-> m (Maybe (FieldParser n (AnnotatedInsert b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b)))) |
Construct the parser for a field that can be used to add several rows to a DB table.
This function is used to create the insert_tablename root field.
The field accepts the following arguments:
- objects: the list of objects to insert into the table (see tableFieldsInput
)
- parser for backend-specific fields, e.g. upsert fields on_conflict or if_matched
:: forall b r m n. MonadBuildSchema b r m n | |
=> BackendTableSelectSchema b | |
=> (SourceInfo b -> TableInfo b -> m (InputFieldsParser n (BackendInsert b (UnpreparedValue b)))) | |
-> Scenario | |
-> SourceInfo b | source of the table |
-> TableInfo b | table info |
-> Name | field display name |
-> Maybe Description | field description, if any |
-> m (Maybe (FieldParser n (AnnotatedInsert b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b)))) |
Variant of insertIntoTable
that inserts a single row.
Instead of expecting a list of rows to insert in a objects
argument, this
field instead expects a single object
. Its selection set is also slightly
different: it only allows selecting columns from the row being inserted.
:: forall b r m n. MonadBuildSchema b r m n | |
=> SourceInfo b | |
-> TableInfo b | qualified name of the table |
-> m (Parser 'Input n (AnnotatedInsertRow b (UnpreparedValue b))) |
Creates the parser for an input object for a row of the given table.
This function creates an input object type named "tablename_insert_input" in the GraphQL shema, which has a field for each of the columns of that table that the user has insert permissions for.
{ insert_author ( objects: [ { # tableFieldsInput output name: "John", id:12 } ] ... ) ... }
mkDefaultRelationshipParser :: forall b r m n. MonadBuildSchema b r m n => (SourceInfo b -> TableInfo b -> m (InputFieldsParser n (BackendInsert b (UnpreparedValue b)))) -> XNestedInserts b -> SourceInfo b -> RelInfo b -> m (Maybe (InputFieldsParser n (Maybe (AnnotatedInsertField b (UnpreparedValue b))))) Source #
objectRelationshipInput :: forall b r m n. MonadBuildSchema b r m n => (SourceInfo b -> TableInfo b -> m (InputFieldsParser n (BackendInsert b (UnpreparedValue b)))) -> SourceInfo b -> TableInfo b -> m (Maybe (Parser 'Input n (SingleObjectInsert b (UnpreparedValue b)))) Source #
Construct the parser for an input object that represents an insert through an object relationship.
When inserting objects into tables, we allow insertions through
relationships. This function creates the parser for an object that represents
the insertion object across an object relationship; it is co-recursive with
tableFieldsInput
.
arrayRelationshipInput :: forall b r m n. MonadBuildSchema b r m n => (SourceInfo b -> TableInfo b -> m (InputFieldsParser n (BackendInsert b (UnpreparedValue b)))) -> SourceInfo b -> TableInfo b -> m (Maybe (Parser 'Input n (MultiObjectInsert b (UnpreparedValue b)))) Source #
Construct the parser for an input object that represents an insert through an array relationship.
When inserting objects into tables, we allow insertions through
relationships. This function creates the parser for an object that represents
the insertion object across an array relationship; it is co-recursive with
tableFieldsInput
.
mkInsertObject :: forall b f. BackendSchema b => f (AnnotatedInsertRow b (UnpreparedValue b)) -> TableInfo b -> BackendInsert b (UnpreparedValue b) -> InsPermInfo b -> Maybe (UpdPermInfo b) -> AnnotatedInsertData b f (UnpreparedValue b) Source #
Helper function that creates an AnnIns
object.
:: forall b r m n. (MonadBuildSchema b r m n, AggregationPredicatesSchema b, BackendTableSelectSchema b) | |
=> Scenario | |
-> SourceInfo b | table source |
-> TableInfo b | table info |
-> Name | field display name |
-> Maybe Description | field description, if any |
-> m (Maybe (FieldParser n (AnnDelG b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b)))) |
Construct a root field, normally called delete_tablename, that can be used to delete several rows from a DB table
:: forall b r m n. MonadBuildSchema b r m n | |
=> BackendTableSelectSchema b | |
=> Scenario | |
-> SourceInfo b | table source |
-> TableInfo b | table info |
-> Name | field display name |
-> Maybe Description | field description, if any |
-> m (Maybe (FieldParser n (AnnDelG b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b)))) |
Construct a root field, normally called delete_tablename_by_pk, that can be used to delete an individual rows from a DB table, specified by primary key. Select permissions are required, as the user must be allowed to access all the primary keys of the table.
mkDeleteObject :: Backend b => TableName b -> [ColumnInfo b] -> DelPermInfo b -> Maybe NamingCase -> (AnnBoolExp b (UnpreparedValue b), MutationOutputG b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b)) -> AnnDelG b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b) Source #
mutationSelectionSet :: forall b r m n. MonadBuildSchema b r m n => BackendTableSelectSchema b => SourceInfo b -> TableInfo b -> m (Parser 'Output n (MutFldsG b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b))) Source #
All mutations allow returning results, such as what the updated database rows look like. This parser allows a query to specify what data to fetch.
primaryKeysArguments :: forall b r m n. MonadBuildSchema b r m n => TableInfo b -> m (Maybe (InputFieldsParser n (AnnBoolExp b (UnpreparedValue b)))) Source #
How to specify a database row by primary key.
This will give Nothing
when either there are no primary keys defined for
the table or when the given permissions do not permit selecting from all the
columns that make up the key.