{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Athena.Types.ResultSet where
import Amazonka.Athena.Types.ResultSetMetadata
import Amazonka.Athena.Types.Row
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ResultSet = ResultSet'
{
ResultSet -> Maybe [Row]
rows :: Prelude.Maybe [Row],
ResultSet -> Maybe ResultSetMetadata
resultSetMetadata :: Prelude.Maybe ResultSetMetadata
}
deriving (ResultSet -> ResultSet -> Bool
(ResultSet -> ResultSet -> Bool)
-> (ResultSet -> ResultSet -> Bool) -> Eq ResultSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResultSet -> ResultSet -> Bool
$c/= :: ResultSet -> ResultSet -> Bool
== :: ResultSet -> ResultSet -> Bool
$c== :: ResultSet -> ResultSet -> Bool
Prelude.Eq, ReadPrec [ResultSet]
ReadPrec ResultSet
Int -> ReadS ResultSet
ReadS [ResultSet]
(Int -> ReadS ResultSet)
-> ReadS [ResultSet]
-> ReadPrec ResultSet
-> ReadPrec [ResultSet]
-> Read ResultSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResultSet]
$creadListPrec :: ReadPrec [ResultSet]
readPrec :: ReadPrec ResultSet
$creadPrec :: ReadPrec ResultSet
readList :: ReadS [ResultSet]
$creadList :: ReadS [ResultSet]
readsPrec :: Int -> ReadS ResultSet
$creadsPrec :: Int -> ReadS ResultSet
Prelude.Read, Int -> ResultSet -> ShowS
[ResultSet] -> ShowS
ResultSet -> String
(Int -> ResultSet -> ShowS)
-> (ResultSet -> String)
-> ([ResultSet] -> ShowS)
-> Show ResultSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResultSet] -> ShowS
$cshowList :: [ResultSet] -> ShowS
show :: ResultSet -> String
$cshow :: ResultSet -> String
showsPrec :: Int -> ResultSet -> ShowS
$cshowsPrec :: Int -> ResultSet -> ShowS
Prelude.Show, (forall x. ResultSet -> Rep ResultSet x)
-> (forall x. Rep ResultSet x -> ResultSet) -> Generic ResultSet
forall x. Rep ResultSet x -> ResultSet
forall x. ResultSet -> Rep ResultSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResultSet x -> ResultSet
$cfrom :: forall x. ResultSet -> Rep ResultSet x
Prelude.Generic)
newResultSet ::
ResultSet
newResultSet :: ResultSet
newResultSet =
ResultSet' :: Maybe [Row] -> Maybe ResultSetMetadata -> ResultSet
ResultSet'
{ $sel:rows:ResultSet' :: Maybe [Row]
rows = Maybe [Row]
forall a. Maybe a
Prelude.Nothing,
$sel:resultSetMetadata:ResultSet' :: Maybe ResultSetMetadata
resultSetMetadata = Maybe ResultSetMetadata
forall a. Maybe a
Prelude.Nothing
}
resultSet_rows :: Lens.Lens' ResultSet (Prelude.Maybe [Row])
resultSet_rows :: (Maybe [Row] -> f (Maybe [Row])) -> ResultSet -> f ResultSet
resultSet_rows = (ResultSet -> Maybe [Row])
-> (ResultSet -> Maybe [Row] -> ResultSet)
-> Lens ResultSet ResultSet (Maybe [Row]) (Maybe [Row])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResultSet' {Maybe [Row]
rows :: Maybe [Row]
$sel:rows:ResultSet' :: ResultSet -> Maybe [Row]
rows} -> Maybe [Row]
rows) (\s :: ResultSet
s@ResultSet' {} Maybe [Row]
a -> ResultSet
s {$sel:rows:ResultSet' :: Maybe [Row]
rows = Maybe [Row]
a} :: ResultSet) ((Maybe [Row] -> f (Maybe [Row])) -> ResultSet -> f ResultSet)
-> ((Maybe [Row] -> f (Maybe [Row]))
-> Maybe [Row] -> f (Maybe [Row]))
-> (Maybe [Row] -> f (Maybe [Row]))
-> ResultSet
-> f ResultSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Row] [Row] [Row] [Row]
-> Iso (Maybe [Row]) (Maybe [Row]) (Maybe [Row]) (Maybe [Row])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Row] [Row] [Row] [Row]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
resultSet_resultSetMetadata :: Lens.Lens' ResultSet (Prelude.Maybe ResultSetMetadata)
resultSet_resultSetMetadata :: (Maybe ResultSetMetadata -> f (Maybe ResultSetMetadata))
-> ResultSet -> f ResultSet
resultSet_resultSetMetadata = (ResultSet -> Maybe ResultSetMetadata)
-> (ResultSet -> Maybe ResultSetMetadata -> ResultSet)
-> Lens
ResultSet
ResultSet
(Maybe ResultSetMetadata)
(Maybe ResultSetMetadata)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResultSet' {Maybe ResultSetMetadata
resultSetMetadata :: Maybe ResultSetMetadata
$sel:resultSetMetadata:ResultSet' :: ResultSet -> Maybe ResultSetMetadata
resultSetMetadata} -> Maybe ResultSetMetadata
resultSetMetadata) (\s :: ResultSet
s@ResultSet' {} Maybe ResultSetMetadata
a -> ResultSet
s {$sel:resultSetMetadata:ResultSet' :: Maybe ResultSetMetadata
resultSetMetadata = Maybe ResultSetMetadata
a} :: ResultSet)
instance Core.FromJSON ResultSet where
parseJSON :: Value -> Parser ResultSet
parseJSON =
String -> (Object -> Parser ResultSet) -> Value -> Parser ResultSet
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ResultSet"
( \Object
x ->
Maybe [Row] -> Maybe ResultSetMetadata -> ResultSet
ResultSet'
(Maybe [Row] -> Maybe ResultSetMetadata -> ResultSet)
-> Parser (Maybe [Row])
-> Parser (Maybe ResultSetMetadata -> ResultSet)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Row]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Rows" Parser (Maybe (Maybe [Row])) -> Maybe [Row] -> Parser (Maybe [Row])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Row]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe ResultSetMetadata -> ResultSet)
-> Parser (Maybe ResultSetMetadata) -> Parser ResultSet
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ResultSetMetadata)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ResultSetMetadata")
)
instance Prelude.Hashable ResultSet
instance Prelude.NFData ResultSet