graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hasura.GraphQL.Schema.Update

Description

This module provides common building blocks for composing Schema Parsers used in the schema of Update Mutations.

Synopsis

Documentation

data UpdateOperator b r m n op Source #

UpdateOperator b m n op represents one single update operator for a backend b.

The type variable op is the backend-specific data type that represents update operators, typically in the form of a sum-type with an UnpreparedValue b in each constructor.

The UpdateOperator b m n is a Functor. There exist building blocks of common update operators (such as setOp, etc.) which have op ~ UnpreparedValue b. The Functor instance lets you wrap the generic update operators in backend-specific tags.

Instances

Instances details
(Functor m, Functor n) => Functor (UpdateOperator b r m n) Source # 
Instance details

Defined in Hasura.GraphQL.Schema.Update

Methods

fmap :: (a -> b0) -> UpdateOperator b r m n a -> UpdateOperator b r m n b0 #

(<$) :: a -> UpdateOperator b r m n b0 -> UpdateOperator b r m n a #

buildUpdateOperators Source #

Arguments

:: forall b r m n op. MonadBuildSchema b r m n 
=> HashMap (Column b) op

Columns with preset expressions

-> [UpdateOperator b r m n op]

Update operators to include in the Schema

-> TableInfo b 
-> SchemaT r m (InputFieldsParser n (HashMap (Column b) op)) 

The top-level component for building update operators parsers.

presetColumns :: UpdPermInfo b -> HashMap (Column b) (UnpreparedValue b) Source #

The columns that have preset definitions applied to them. (see <https://hasura.io/docs/latest/graphql/core/auth/authorization/permission-rules.html#column-presets Permissions user docs>)

updateOperator :: forall n r m b a. MonadBuildSchema b r m n => GQLNameIdentifier -> GQLNameIdentifier -> GQLNameIdentifier -> (ColumnInfo b -> SchemaT r m (Parser 'Both n a)) -> NonEmpty (ColumnInfo b) -> Description -> Description -> SchemaT r m (InputFieldsParser n (HashMap (Column b) a)) Source #

Construct a parser for a single update operator.

updateOperator _ "op" fp MkOp ["col1","col2"] gives a parser that accepts objects in the shape of:

op: {
  col1: "x",
  col2: "y"
}

And (morally) parses into values:

HashMap.fromList [("col1", MkOp (fp "x")), ("col2", MkOp (fp "y"))]

setOp :: forall b n r m. MonadBuildSchema b r m n => UpdateOperator b r m n (UnpreparedValue b) Source #

incOp :: forall b m n r. MonadBuildSchema b r m n => UpdateOperator b r m n (UnpreparedValue b) Source #