graphql-engine/server/src-lib/Hasura/RQL/IR/Delete.hs
hasura-bot 64743cb189 server: all remaining IR changes (#75)
Co-authored-by: Antoine Leblanc <antoine@hasura.io>
GITHUB_PR_NUMBER: 6233
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/6233

Co-authored-by: Antoine Leblanc <antoine@hasura.io>
Co-authored-by: Auke Booij <auke@hasura.io>
GitOrigin-RevId: 268cdad529ad5d9bebeb5b881fda5413ea9d7715
2020-11-25 14:19:50 +00:00

34 lines
859 B
Haskell

module Hasura.RQL.IR.Delete where
import Hasura.Prelude
import Hasura.RQL.IR.BoolExp
import Hasura.RQL.IR.Returning
import Hasura.RQL.Types.Column
import Hasura.RQL.Types.Common
import Hasura.SQL.Backend
data AnnDelG (b :: BackendType) v
= AnnDel
{ dqp1Table :: !(TableName b)
, dqp1Where :: !(AnnBoolExp b v, AnnBoolExp b v)
, dqp1Output :: !(MutationOutputG b v)
, dqp1AllCols :: ![ColumnInfo b]
}
type AnnDel b = AnnDelG b (SQLExpression b)
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