graphql-engine/server/src-dc-api/Hasura/Backends/DataConnector/API/V0/Explain.hs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
761 B
Haskell
Raw Normal View History

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