graphql-engine/server/src-lib/Hasura/Backends/Postgres/Translate/Delete.hs
Antoine Leblanc 3cbcbd9291 Remove RQL/Types.hs
## Description

This PR removes `RQL.Types`, which was now only re-exporting a bunch of unrelated modules.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4363
GitOrigin-RevId: 894f29a19bff70b3dad8abc5d9858434d5065417
2022-04-27 13:58:47 +00:00

30 lines
798 B
Haskell

-- | Postgres Translate Delete
--
-- Tranlates an IR delete term to a Postgres SQL DELETE statement.
--
-- See 'Hasura.Backends.Postgres.Execute.Mutation.execDeleteQuery'.
module Hasura.Backends.Postgres.Translate.Delete
( mkDelete,
)
where
import Hasura.Backends.Postgres.SQL.DML qualified as S
import Hasura.Backends.Postgres.Translate.BoolExp
import Hasura.Prelude
import Hasura.RQL.IR.BoolExp
import Hasura.RQL.IR.Delete
import Hasura.RQL.Types.Backend
import Hasura.SQL.Backend
mkDelete ::
Backend ('Postgres pgKind) =>
AnnDel ('Postgres pgKind) ->
S.SQLDelete
mkDelete (AnnDel tn (fltr, wc) _ _) =
S.SQLDelete tn Nothing tableFltr $ Just S.returningStar
where
tableFltr =
Just $
S.WhereFrag $
toSQLBoolExp (S.QualTable tn) $ andAnnBoolExps fltr wc