Safe Haskell | None |
---|---|
Language | Haskell2010 |
Postgres Instances Schema
Defines a BackendSchema
type class instance for Postgres.
Synopsis
- class PostgresSchema (pgKind :: PostgresKind) where
- pgkBuildTableRelayQueryFields :: forall r m n. MonadBuildSchema ('Postgres pgKind) r m n => MkRootFieldName -> SourceInfo ('Postgres pgKind) -> TableName ('Postgres pgKind) -> TableInfo ('Postgres pgKind) -> GQLNameIdentifier -> NESeq (ColumnInfo ('Postgres pgKind)) -> m [FieldParser n (QueryDB ('Postgres pgKind) (RemoteRelationshipField UnpreparedValue) (UnpreparedValue ('Postgres pgKind)))]
- pgkBuildFunctionRelayQueryFields :: forall r m n. MonadBuildSchema ('Postgres pgKind) r m n => MkRootFieldName -> SourceInfo ('Postgres pgKind) -> FunctionName ('Postgres pgKind) -> FunctionInfo ('Postgres pgKind) -> TableName ('Postgres pgKind) -> NESeq (ColumnInfo ('Postgres pgKind)) -> m [FieldParser n (QueryDB ('Postgres pgKind) (RemoteRelationshipField UnpreparedValue) (UnpreparedValue ('Postgres pgKind)))]
- pgkRelayExtension :: Maybe (XRelay ('Postgres pgKind))
- _aggregationFunctions :: [FunctionSignature ('Postgres pgKind)]
- backendInsertParser :: forall pgKind m r n. MonadBuildSchema ('Postgres pgKind) r m n => SourceInfo ('Postgres pgKind) -> TableInfo ('Postgres pgKind) -> m (InputFieldsParser n (BackendInsert pgKind (UnpreparedValue ('Postgres pgKind))))
- buildTableRelayQueryFields :: forall r m n pgKind. (MonadBuildSchema ('Postgres pgKind) r m n, BackendTableSelectSchema ('Postgres pgKind)) => MkRootFieldName -> SourceInfo ('Postgres pgKind) -> TableName ('Postgres pgKind) -> TableInfo ('Postgres pgKind) -> GQLNameIdentifier -> NESeq (ColumnInfo ('Postgres pgKind)) -> m [FieldParser n (QueryDB ('Postgres pgKind) (RemoteRelationshipField UnpreparedValue) (UnpreparedValue ('Postgres pgKind)))]
- pgkBuildTableUpdateMutationFields :: forall r m n pgKind. (MonadBuildSchema ('Postgres pgKind) r m n, BackendTableSelectSchema ('Postgres pgKind)) => MkRootFieldName -> Scenario -> SourceInfo ('Postgres pgKind) -> TableName ('Postgres pgKind) -> TableInfo ('Postgres pgKind) -> GQLNameIdentifier -> m [FieldParser n (AnnotatedUpdateG ('Postgres pgKind) (RemoteRelationshipField UnpreparedValue) (UnpreparedValue ('Postgres pgKind)))]
- updateTableMany :: forall r m n pgKind. (MonadBuildSchema ('Postgres pgKind) r m n, BackendTableSelectSchema ('Postgres pgKind)) => MkRootFieldName -> Scenario -> SourceInfo ('Postgres pgKind) -> TableInfo ('Postgres pgKind) -> GQLNameIdentifier -> m (Maybe (FieldParser n (AnnotatedUpdateG ('Postgres pgKind) (RemoteRelationshipField UnpreparedValue) (UnpreparedValue ('Postgres pgKind)))))
- mkMultiRowUpdateParser :: forall pgKind r m n. MonadBuildSchema ('Postgres pgKind) r m n => SourceInfo ('Postgres pgKind) -> TableInfo ('Postgres pgKind) -> UpdPermInfo ('Postgres pgKind) -> m (InputFieldsParser n (BackendUpdate pgKind (UnpreparedValue ('Postgres pgKind))))
- buildFunctionRelayQueryFields :: forall r m n pgKind. (MonadBuildSchema ('Postgres pgKind) r m n, BackendTableSelectSchema ('Postgres pgKind)) => MkRootFieldName -> SourceInfo ('Postgres pgKind) -> FunctionName ('Postgres pgKind) -> FunctionInfo ('Postgres pgKind) -> TableName ('Postgres pgKind) -> NESeq (ColumnInfo ('Postgres pgKind)) -> m [FieldParser n (QueryDB ('Postgres pgKind) (RemoteRelationshipField UnpreparedValue) (UnpreparedValue ('Postgres pgKind)))]
- columnParser :: (MonadParse n, MonadError QErr m, MonadReader r m, Has MkTypename r, Has NamingCase r) => ColumnType ('Postgres pgKind) -> Nullability -> m (Parser 'Both n (ValueWithOrigin (ColumnValue ('Postgres pgKind))))
- pgScalarSelectionArgumentsParser :: MonadParse n => ColumnType ('Postgres pgKind) -> InputFieldsParser n (Maybe (ScalarSelectionArguments ('Postgres pgKind)))
- orderByOperatorsHasuraCase :: (Name, NonEmpty (Definition EnumValueInfo, (BasicOrderType ('Postgres pgKind), NullsOrderType ('Postgres pgKind))))
- orderByOperatorsGraphqlCase :: (Name, NonEmpty (Definition EnumValueInfo, (BasicOrderType ('Postgres pgKind), NullsOrderType ('Postgres pgKind))))
- orderByOperators :: NamingCase -> (Name, NonEmpty (Definition EnumValueInfo, (BasicOrderType ('Postgres pgKind), NullsOrderType ('Postgres pgKind))))
- comparisonExps :: forall pgKind m n r. (BackendSchema ('Postgres pgKind), MonadMemoize m, MonadParse n, MonadError QErr m, MonadReader r m, Has SchemaOptions r, Has MkTypename r, Has NamingCase r) => ColumnType ('Postgres pgKind) -> m (Parser 'Input n [ComparisonExp ('Postgres pgKind)])
- geographyWithinDistanceInput :: forall pgKind m n r. (MonadMemoize m, MonadParse n, MonadError QErr m, MonadReader r m, Has MkTypename r, Has NamingCase r) => m (Parser 'Input n (DWithinGeogOp (UnpreparedValue ('Postgres pgKind))))
- geometryWithinDistanceInput :: forall pgKind m n r. (MonadMemoize m, MonadParse n, MonadError QErr m, MonadReader r m, Has MkTypename r, Has NamingCase r) => m (Parser 'Input n (DWithinGeomOp (UnpreparedValue ('Postgres pgKind))))
- intersectsNbandGeomInput :: forall pgKind m n r. (MonadMemoize m, MonadParse n, MonadError QErr m, MonadReader r m, Has MkTypename r, Has NamingCase r) => m (Parser 'Input n (STIntersectsNbandGeommin (UnpreparedValue ('Postgres pgKind))))
- intersectsGeomNbandInput :: forall pgKind m n r. (MonadMemoize m, MonadParse n, MonadError QErr m, MonadReader r m, Has MkTypename r, Has NamingCase r) => m (Parser 'Input n (STIntersectsGeomminNband (UnpreparedValue ('Postgres pgKind))))
- countTypeInput :: MonadParse n => Maybe (Parser 'Both n (Column ('Postgres pgKind))) -> InputFieldsParser n (CountDistinct -> CountType ('Postgres pgKind))
- prependOp :: forall pgKind m n r. (BackendSchema ('Postgres pgKind), MonadReader r m, MonadError QErr m, MonadParse n, Has MkTypename r, Has NamingCase r) => UpdateOperator ('Postgres pgKind) m n (UnpreparedValue ('Postgres pgKind))
- appendOp :: forall pgKind m n r. (BackendSchema ('Postgres pgKind), MonadReader r m, MonadError QErr m, MonadParse n, Has MkTypename r, Has NamingCase r) => UpdateOperator ('Postgres pgKind) m n (UnpreparedValue ('Postgres pgKind))
- deleteKeyOp :: forall pgKind m n r. (BackendSchema ('Postgres pgKind), MonadReader r m, MonadError QErr m, MonadParse n, Has MkTypename r, Has NamingCase r) => UpdateOperator ('Postgres pgKind) m n (UnpreparedValue ('Postgres pgKind))
- deleteElemOp :: forall pgKind m n r. (BackendSchema ('Postgres pgKind), MonadReader r m, MonadError QErr m, MonadParse n, Has MkTypename r, Has NamingCase r) => UpdateOperator ('Postgres pgKind) m n (UnpreparedValue ('Postgres pgKind))
- deleteAtPathOp :: forall pgKind m n r. (BackendSchema ('Postgres pgKind), MonadReader r m, MonadError QErr m, MonadParse n, Has MkTypename r, Has NamingCase r) => UpdateOperator ('Postgres pgKind) m n [UnpreparedValue ('Postgres pgKind)]
- updateOperators :: forall pgKind m n r. MonadBuildSchema ('Postgres pgKind) r m n => TableInfo ('Postgres pgKind) -> UpdPermInfo ('Postgres pgKind) -> m (InputFieldsParser n (HashMap (Column ('Postgres pgKind)) (UpdateOpExpression (UnpreparedValue ('Postgres pgKind)))))
Documentation
class PostgresSchema (pgKind :: PostgresKind) where Source #
This class is an implementation detail of BackendSchema
.
Some functions of BackendSchema
differ across different Postgres "kinds",
or call to functions (such as those related to Relay) that have not been
generalized to all kinds of Postgres and still explicitly work on Vanilla
Postgres. This class allows each "kind" to specify its own specific
implementation. All common code is directly part of BackendSchema
.
Note: Users shouldn't ever put this as a constraint. Use `BackendSchema ('Postgres pgKind)` instead.
pgkBuildTableRelayQueryFields :: forall r m n. MonadBuildSchema ('Postgres pgKind) r m n => MkRootFieldName -> SourceInfo ('Postgres pgKind) -> TableName ('Postgres pgKind) -> TableInfo ('Postgres pgKind) -> GQLNameIdentifier -> NESeq (ColumnInfo ('Postgres pgKind)) -> m [FieldParser n (QueryDB ('Postgres pgKind) (RemoteRelationshipField UnpreparedValue) (UnpreparedValue ('Postgres pgKind)))] Source #
pgkBuildFunctionRelayQueryFields :: forall r m n. MonadBuildSchema ('Postgres pgKind) r m n => MkRootFieldName -> SourceInfo ('Postgres pgKind) -> FunctionName ('Postgres pgKind) -> FunctionInfo ('Postgres pgKind) -> TableName ('Postgres pgKind) -> NESeq (ColumnInfo ('Postgres pgKind)) -> m [FieldParser n (QueryDB ('Postgres pgKind) (RemoteRelationshipField UnpreparedValue) (UnpreparedValue ('Postgres pgKind)))] Source #
pgkRelayExtension :: Maybe (XRelay ('Postgres pgKind)) Source #
_aggregationFunctions :: [FunctionSignature ('Postgres pgKind)] Source #
The aggregation functions that are supported by postgres variants. TODO: Add more.
backendInsertParser :: forall pgKind m r n. MonadBuildSchema ('Postgres pgKind) r m n => SourceInfo ('Postgres pgKind) -> TableInfo ('Postgres pgKind) -> m (InputFieldsParser n (BackendInsert pgKind (UnpreparedValue ('Postgres pgKind)))) Source #
buildTableRelayQueryFields :: forall r m n pgKind. (MonadBuildSchema ('Postgres pgKind) r m n, BackendTableSelectSchema ('Postgres pgKind)) => MkRootFieldName -> SourceInfo ('Postgres pgKind) -> TableName ('Postgres pgKind) -> TableInfo ('Postgres pgKind) -> GQLNameIdentifier -> NESeq (ColumnInfo ('Postgres pgKind)) -> m [FieldParser n (QueryDB ('Postgres pgKind) (RemoteRelationshipField UnpreparedValue) (UnpreparedValue ('Postgres pgKind)))] Source #
pgkBuildTableUpdateMutationFields Source #
:: forall r m n pgKind. (MonadBuildSchema ('Postgres pgKind) r m n, BackendTableSelectSchema ('Postgres pgKind)) | |
=> MkRootFieldName | |
-> Scenario | |
-> SourceInfo ('Postgres pgKind) | The source that the table lives in |
-> TableName ('Postgres pgKind) | The name of the table being acted on |
-> TableInfo ('Postgres pgKind) | table info |
-> GQLNameIdentifier | field display name |
-> m [FieldParser n (AnnotatedUpdateG ('Postgres pgKind) (RemoteRelationshipField UnpreparedValue) (UnpreparedValue ('Postgres pgKind)))] |
updateTableMany :: forall r m n pgKind. (MonadBuildSchema ('Postgres pgKind) r m n, BackendTableSelectSchema ('Postgres pgKind)) => MkRootFieldName -> Scenario -> SourceInfo ('Postgres pgKind) -> TableInfo ('Postgres pgKind) -> GQLNameIdentifier -> m (Maybe (FieldParser n (AnnotatedUpdateG ('Postgres pgKind) (RemoteRelationshipField UnpreparedValue) (UnpreparedValue ('Postgres pgKind))))) Source #
Create a parser for update_table_many
. This function is very similar to
both buildTableUpdateMutationFields
and
updateTable
.
It is similar to the former because of its shape: has to deal with grabbing the casing, deals with update permissions, etc.
It is similar to the latter because it deals with creating the parsersubselectionetc.
The reason this function exists here is because it is Postgres specific. It would not fit very well next to the functions mentioned above.
However, if you are trying to implement this feature for other backends,
please consider making this function similar to updateTable and moving it
there.
Note: this will likely require adding a type or a function to
BackendSchema
.
mkMultiRowUpdateParser :: forall pgKind r m n. MonadBuildSchema ('Postgres pgKind) r m n => SourceInfo ('Postgres pgKind) -> TableInfo ('Postgres pgKind) -> UpdPermInfo ('Postgres pgKind) -> m (InputFieldsParser n (BackendUpdate pgKind (UnpreparedValue ('Postgres pgKind)))) Source #
Create a parser for the updates section of the update_table_many
update.
It parses a list with two fields: 'where', and an update expression (setincetc).
buildFunctionRelayQueryFields :: forall r m n pgKind. (MonadBuildSchema ('Postgres pgKind) r m n, BackendTableSelectSchema ('Postgres pgKind)) => MkRootFieldName -> SourceInfo ('Postgres pgKind) -> FunctionName ('Postgres pgKind) -> FunctionInfo ('Postgres pgKind) -> TableName ('Postgres pgKind) -> NESeq (ColumnInfo ('Postgres pgKind)) -> m [FieldParser n (QueryDB ('Postgres pgKind) (RemoteRelationshipField UnpreparedValue) (UnpreparedValue ('Postgres pgKind)))] Source #
columnParser :: (MonadParse n, MonadError QErr m, MonadReader r m, Has MkTypename r, Has NamingCase r) => ColumnType ('Postgres pgKind) -> Nullability -> m (Parser 'Both n (ValueWithOrigin (ColumnValue ('Postgres pgKind)))) Source #
pgScalarSelectionArgumentsParser :: MonadParse n => ColumnType ('Postgres pgKind) -> InputFieldsParser n (Maybe (ScalarSelectionArguments ('Postgres pgKind))) Source #
orderByOperatorsHasuraCase :: (Name, NonEmpty (Definition EnumValueInfo, (BasicOrderType ('Postgres pgKind), NullsOrderType ('Postgres pgKind)))) Source #
orderByOperatorsGraphqlCase :: (Name, NonEmpty (Definition EnumValueInfo, (BasicOrderType ('Postgres pgKind), NullsOrderType ('Postgres pgKind)))) Source #
orderByOperators :: NamingCase -> (Name, NonEmpty (Definition EnumValueInfo, (BasicOrderType ('Postgres pgKind), NullsOrderType ('Postgres pgKind)))) Source #
Do NOT use this function directly, this should be used via
orderByOperatorsHasuraCase
or orderByOperatorsGraphqlCase
comparisonExps :: forall pgKind m n r. (BackendSchema ('Postgres pgKind), MonadMemoize m, MonadParse n, MonadError QErr m, MonadReader r m, Has SchemaOptions r, Has MkTypename r, Has NamingCase r) => ColumnType ('Postgres pgKind) -> m (Parser 'Input n [ComparisonExp ('Postgres pgKind)]) Source #
geographyWithinDistanceInput :: forall pgKind m n r. (MonadMemoize m, MonadParse n, MonadError QErr m, MonadReader r m, Has MkTypename r, Has NamingCase r) => m (Parser 'Input n (DWithinGeogOp (UnpreparedValue ('Postgres pgKind)))) Source #
geometryWithinDistanceInput :: forall pgKind m n r. (MonadMemoize m, MonadParse n, MonadError QErr m, MonadReader r m, Has MkTypename r, Has NamingCase r) => m (Parser 'Input n (DWithinGeomOp (UnpreparedValue ('Postgres pgKind)))) Source #
intersectsNbandGeomInput :: forall pgKind m n r. (MonadMemoize m, MonadParse n, MonadError QErr m, MonadReader r m, Has MkTypename r, Has NamingCase r) => m (Parser 'Input n (STIntersectsNbandGeommin (UnpreparedValue ('Postgres pgKind)))) Source #
intersectsGeomNbandInput :: forall pgKind m n r. (MonadMemoize m, MonadParse n, MonadError QErr m, MonadReader r m, Has MkTypename r, Has NamingCase r) => m (Parser 'Input n (STIntersectsGeomminNband (UnpreparedValue ('Postgres pgKind)))) Source #
countTypeInput :: MonadParse n => Maybe (Parser 'Both n (Column ('Postgres pgKind))) -> InputFieldsParser n (CountDistinct -> CountType ('Postgres pgKind)) Source #
prependOp :: forall pgKind m n r. (BackendSchema ('Postgres pgKind), MonadReader r m, MonadError QErr m, MonadParse n, Has MkTypename r, Has NamingCase r) => UpdateOperator ('Postgres pgKind) m n (UnpreparedValue ('Postgres pgKind)) Source #
Update operator that prepends a value to a column containing jsonb arrays.
Note: Currently this is Postgres specific because json columns have not been ported to other backends yet.
appendOp :: forall pgKind m n r. (BackendSchema ('Postgres pgKind), MonadReader r m, MonadError QErr m, MonadParse n, Has MkTypename r, Has NamingCase r) => UpdateOperator ('Postgres pgKind) m n (UnpreparedValue ('Postgres pgKind)) Source #
Update operator that appends a value to a column containing jsonb arrays.
Note: Currently this is Postgres specific because json columns have not been ported to other backends yet.
deleteKeyOp :: forall pgKind m n r. (BackendSchema ('Postgres pgKind), MonadReader r m, MonadError QErr m, MonadParse n, Has MkTypename r, Has NamingCase r) => UpdateOperator ('Postgres pgKind) m n (UnpreparedValue ('Postgres pgKind)) Source #
Update operator that deletes a value at a specified key from a column containing jsonb objects.
Note: Currently this is Postgres specific because json columns have not been ported to other backends yet.
deleteElemOp :: forall pgKind m n r. (BackendSchema ('Postgres pgKind), MonadReader r m, MonadError QErr m, MonadParse n, Has MkTypename r, Has NamingCase r) => UpdateOperator ('Postgres pgKind) m n (UnpreparedValue ('Postgres pgKind)) Source #
Update operator that deletes a value at a specific index from a column containing jsonb arrays.
Note: Currently this is Postgres specific because json columns have not been ported to other backends yet.
deleteAtPathOp :: forall pgKind m n r. (BackendSchema ('Postgres pgKind), MonadReader r m, MonadError QErr m, MonadParse n, Has MkTypename r, Has NamingCase r) => UpdateOperator ('Postgres pgKind) m n [UnpreparedValue ('Postgres pgKind)] Source #
Update operator that deletes a field at a certan path from a column containing jsonb objects.
Note: Currently this is Postgres specific because json columns have not been ported to other backends yet.
updateOperators :: forall pgKind m n r. MonadBuildSchema ('Postgres pgKind) r m n => TableInfo ('Postgres pgKind) -> UpdPermInfo ('Postgres pgKind) -> m (InputFieldsParser n (HashMap (Column ('Postgres pgKind)) (UpdateOpExpression (UnpreparedValue ('Postgres pgKind))))) Source #
The update operators that we support on Postgres.