mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-18 04:51:35 +03:00
24 lines
620 B
Haskell
24 lines
620 B
Haskell
|
module Hasura.Backends.Postgres.Translate.Delete
|
||
|
( mkDeleteCTE
|
||
|
) where
|
||
|
|
||
|
import Hasura.Prelude
|
||
|
|
||
|
import Instances.TH.Lift ()
|
||
|
|
||
|
import qualified Hasura.Backends.Postgres.SQL.DML as S
|
||
|
|
||
|
import Hasura.RQL.GBoolExp
|
||
|
import Hasura.RQL.IR.Delete
|
||
|
import Hasura.RQL.Types
|
||
|
|
||
|
|
||
|
mkDeleteCTE
|
||
|
:: AnnDel 'Postgres -> S.CTE
|
||
|
mkDeleteCTE (AnnDel tn (fltr, wc) _ _) =
|
||
|
S.CTEDelete delete
|
||
|
where
|
||
|
delete = S.SQLDelete tn Nothing tableFltr $ Just S.returningStar
|
||
|
tableFltr = Just $ S.WhereFrag $
|
||
|
toSQLBoolExp (S.QualTable tn) $ andAnnBoolExps fltr wc
|