mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-17 12:31:52 +03:00
41054de113
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9499 Co-authored-by: gneeri <10553562+gneeri@users.noreply.github.com> GitOrigin-RevId: 1e351556c43e643aa973f87adc0306f076cd227e
28 lines
894 B
Haskell
28 lines
894 B
Haskell
{-# LANGUAGE UndecidableInstances #-}
|
|
|
|
module Hasura.LogicalModel.IR
|
|
( LogicalModel (..),
|
|
)
|
|
where
|
|
|
|
import Data.Aeson (ToJSON (toEncoding), defaultOptions, genericToEncoding)
|
|
import Data.HashMap.Strict.InsOrd qualified as InsOrdHashMap
|
|
import Hasura.LogicalModel.Types (LogicalModelField, LogicalModelName)
|
|
import Hasura.Prelude hiding (first)
|
|
import Hasura.RQL.Types.Backend (Backend (..))
|
|
import Hasura.RQL.Types.BackendType (BackendType)
|
|
|
|
-- | Description of a logical model for use in IR
|
|
data LogicalModel (b :: BackendType) = LogicalModel
|
|
{ lmName :: LogicalModelName,
|
|
lmFields :: InsOrdHashMap.InsOrdHashMap (Column b) (LogicalModelField b)
|
|
}
|
|
deriving (Generic)
|
|
|
|
deriving instance (Backend b) => Eq (LogicalModel b)
|
|
|
|
deriving instance (Backend b) => Show (LogicalModel b)
|
|
|
|
instance (Backend b) => ToJSON (LogicalModel b) where
|
|
toEncoding = genericToEncoding defaultOptions
|