mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-17 12:31:52 +03:00
6178a1fd82
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8989 GitOrigin-RevId: f0f6e75732408f21ebe5fdc5af3f680cd96ae789
40 lines
1.5 KiB
Haskell
40 lines
1.5 KiB
Haskell
{-# LANGUAGE UndecidableInstances #-}
|
|
|
|
-- | The representation of stored procedures as derived from the schema cache.
|
|
module Hasura.StoredProcedure.Cache
|
|
( StoredProcedureInfo (..),
|
|
StoredProcedureCache,
|
|
)
|
|
where
|
|
|
|
import Data.Aeson (ToJSON (toJSON), genericToJSON)
|
|
import Hasura.LogicalModel.Cache (LogicalModelInfo)
|
|
import Hasura.Prelude
|
|
import Hasura.RQL.Types.Backend (Backend)
|
|
import Hasura.RQL.Types.BackendType (BackendType)
|
|
import Hasura.RQL.Types.Common (RelName)
|
|
import Hasura.RQL.Types.Relationships.Local (RelInfo)
|
|
import Hasura.RQL.Types.Table (RolePermInfoMap)
|
|
import Hasura.StoredProcedure.Metadata (InterpolatedQuery, StoredProcedureArgumentName, StoredProcedureName)
|
|
import Hasura.StoredProcedure.Types (NullableScalarType)
|
|
|
|
type StoredProcedureCache b = HashMap StoredProcedureName (StoredProcedureInfo b)
|
|
|
|
-- | The type into which 'StoredProcedureMetadata' is resolved in
|
|
-- 'Hasura/RQL/DDL/Schema/Cache.buildSchemaCacheRule'.
|
|
data StoredProcedureInfo (b :: BackendType) = StoredProcedureInfo
|
|
{ _spiRootFieldName :: StoredProcedureName,
|
|
_spiCode :: InterpolatedQuery StoredProcedureArgumentName,
|
|
_spiReturns :: LogicalModelInfo b,
|
|
_spiArguments :: HashMap StoredProcedureArgumentName (NullableScalarType b),
|
|
_spiArrayRelationships :: InsOrdHashMap RelName (RelInfo b),
|
|
_spiDescription :: Maybe Text
|
|
}
|
|
deriving stock (Generic)
|
|
|
|
instance
|
|
(Backend b, ToJSON (RolePermInfoMap b)) =>
|
|
ToJSON (StoredProcedureInfo b)
|
|
where
|
|
toJSON = genericToJSON hasuraJSON
|