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