graphql-engine/server/src-dc-api/Hasura/Backends/DataConnector/API/V0/Explain.hs
2022-08-29 03:40:16 +00:00

26 lines
761 B
Haskell

module Hasura.Backends.DataConnector.API.V0.Explain
( ExplainResponse (..),
)
where
import Autodocodec
import Autodocodec.OpenAPI ()
import Data.Aeson (FromJSON, ToJSON)
import Data.OpenApi (ToSchema)
import Data.Text (Text)
import Prelude
data ExplainResponse = ExplainResponse
{ _erLines :: [Text],
_erQuery :: Text
}
deriving stock (Eq, Ord, Show)
deriving (ToJSON, FromJSON, ToSchema) via Autodocodec ExplainResponse
instance HasCodec ExplainResponse where
codec =
named "ExplainResponse" . object "ExplainResponse" $
ExplainResponse
<$> requiredField "lines" "Lines of the formatted explain plan response" .= _erLines
<*> requiredField "query" "The generated query - i.e. SQL for a relational DB" .= _erQuery