2020-10-29 19:58:13 +03:00
|
|
|
module Hasura.Backends.Postgres.Translate.Delete
|
2021-09-24 01:56:37 +03:00
|
|
|
( mkDelete,
|
|
|
|
)
|
|
|
|
where
|
2020-10-29 19:58:13 +03:00
|
|
|
|
2021-09-24 01:56:37 +03:00
|
|
|
import Hasura.Backends.Postgres.SQL.DML qualified as S
|
|
|
|
import Hasura.Backends.Postgres.Translate.BoolExp
|
|
|
|
import Hasura.Prelude
|
|
|
|
import Hasura.RQL.IR.Delete
|
|
|
|
import Hasura.RQL.Types
|
2020-10-29 19:58:13 +03:00
|
|
|
|
2021-09-24 01:56:37 +03:00
|
|
|
mkDelete ::
|
|
|
|
Backend ('Postgres pgKind) =>
|
|
|
|
AnnDel ('Postgres pgKind) ->
|
|
|
|
S.SQLDelete
|
2020-11-12 12:25:48 +03:00
|
|
|
mkDelete (AnnDel tn (fltr, wc) _ _) =
|
|
|
|
S.SQLDelete tn Nothing tableFltr $ Just S.returningStar
|
2020-10-29 19:58:13 +03:00
|
|
|
where
|
2021-09-24 01:56:37 +03:00
|
|
|
tableFltr =
|
|
|
|
Just $
|
|
|
|
S.WhereFrag $
|
|
|
|
toSQLBoolExp (S.QualTable tn) $ andAnnBoolExps fltr wc
|