graphql-engine/server/src-lib/Hasura/Backends/Postgres/Translate/Delete.hs
Vishnu Bharathi P 58c44f55dd Merge oss/master onto mono/main
GitOrigin-RevId: 1c8c4d60e033c8a0bc8b2beed24c5bceb7d4bcc8
2020-11-12 22:37:19 +05:30

21 lines
625 B
Haskell

module Hasura.Backends.Postgres.Translate.Delete
( mkDelete
) where
import Hasura.Prelude
import Instances.TH.Lift ()
import qualified Hasura.Backends.Postgres.SQL.DML as S
import Hasura.Backends.Postgres.Translate.BoolExp
import Hasura.RQL.IR.Delete
import Hasura.RQL.Types
mkDelete :: AnnDel 'Postgres -> 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