graphql-engine/server/src-lib/Hasura/RQL/IR/Conflict.hs
Tom Harding e0c0043e76 Upgrade Ormolu to 0.7.0.0
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9284
GitOrigin-RevId: 2f2cf2ad01900a54e4bdb970205ac0ef313c7e00
2023-05-24 13:53:53 +00:00

37 lines
1.0 KiB
Haskell

module Hasura.RQL.IR.Conflict
( OnConflictClause (..),
OnConflictClauseData (..),
ConflictTarget (..),
)
where
import Hasura.Prelude
import Hasura.RQL.IR.BoolExp
import Hasura.RQL.Types.Backend
import Hasura.RQL.Types.BackendType
-- TODO: When adding support for other backends, consider whether these types
-- really are generic. If not, please start by moving them to a Postgres-specific
-- module.
data ConflictTarget (b :: BackendType)
= CTColumn [Column b]
| CTConstraint (ConstraintName b)
deriving instance (Backend b) => Show (ConflictTarget b)
deriving instance (Backend b) => Eq (ConflictTarget b)
data OnConflictClauseData b v = OnConflictClauseData
{ cp1udConflictTarget :: ConflictTarget b,
cp1udAffectedColumns :: [Column b],
cp1udValues :: PreSetColsG b v,
cp1udFilter :: AnnBoolExp b v
}
deriving (Functor, Foldable, Traversable)
data OnConflictClause (b :: BackendType) v
= OCCDoNothing (Maybe (ConflictTarget b))
| OCCUpdate (OnConflictClauseData b v)
deriving (Functor, Foldable, Traversable)