graphql-engine/server/src-lib/Hasura/RQL/IR/Delete.hs
Antoine Leblanc 61c990f177
server: split RQL.DML into four different parts (#6072)
* WIP: shuffle everything around

* remove all unused imports & unused top-level binds

* move types to IR subfolder

* revert unrelated changes to Query and Prepare

* reduce differences in remote join, deprecate Translate module

* clean mutation module

* cosmetic: code formatting

* moved some RQL-specific stuff out of IR

* fix misc compilation issues

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-10-29 16:58:13 +00:00

36 lines
919 B
Haskell

module Hasura.RQL.IR.Delete where
import Hasura.Prelude
import qualified Hasura.Backends.Postgres.SQL.DML as S
import Hasura.Backends.Postgres.SQL.Types
import Hasura.RQL.IR.Returning
import Hasura.RQL.Types.BoolExp
import Hasura.RQL.Types.Column
import Hasura.SQL.Backend
data AnnDelG (b :: Backend) v
= AnnDel
{ dqp1Table :: !QualifiedTable
, dqp1Where :: !(AnnBoolExp b v, AnnBoolExp b v)
, dqp1Output :: !(MutationOutputG b v)
, dqp1AllCols :: ![ColumnInfo b]
}
type AnnDel b = AnnDelG b S.SQLExp
traverseAnnDel
:: (Applicative f)
=> (a -> f b)
-> AnnDelG backend a
-> f (AnnDelG backend b)
traverseAnnDel f annUpd =
AnnDel tn
<$> ((,) <$> traverseAnnBoolExp f whr <*> traverseAnnBoolExp f fltr)
<*> traverseMutationOutput f mutOutput
<*> pure allCols
where
AnnDel tn (whr, fltr) mutOutput allCols = annUpd