mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-23 15:32:27 +03:00
8f4692d871
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9174 GitOrigin-RevId: d440647ac04b9c1717ecf22a2dbfb8c5f22b7c7a
40 lines
1.4 KiB
Haskell
40 lines
1.4 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, FunctionName)
|
|
import Hasura.RQL.Types.BackendType (BackendType)
|
|
import Hasura.StoredProcedure.Metadata (ArgumentName)
|
|
import Hasura.StoredProcedure.Types (NullableScalarType, StoredProcedureConfig)
|
|
import Hasura.Table.Cache (RolePermInfoMap)
|
|
import Language.GraphQL.Draft.Syntax qualified as G
|
|
|
|
type StoredProcedureCache b = HashMap (FunctionName b) (StoredProcedureInfo b)
|
|
|
|
-- | The type into which 'StoredProcedureMetadata' is resolved in
|
|
-- 'Hasura/RQL/DDL/Schema/Cache.buildSchemaCacheRule'.
|
|
data StoredProcedureInfo (b :: BackendType) = StoredProcedureInfo
|
|
{ _spiStoredProcedure :: FunctionName b,
|
|
-- | The GraphQL name of the stored procedure.
|
|
_spiGraphqlName :: G.Name,
|
|
_spiConfig :: StoredProcedureConfig,
|
|
_spiReturns :: LogicalModelInfo b,
|
|
_spiArguments :: HashMap ArgumentName (NullableScalarType b),
|
|
_spiDescription :: Maybe Text
|
|
}
|
|
deriving stock (Generic)
|
|
|
|
instance
|
|
(Backend b, ToJSON (RolePermInfoMap b)) =>
|
|
ToJSON (StoredProcedureInfo b)
|
|
where
|
|
toJSON = genericToJSON hasuraJSON
|