{-# 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.HoneyCode.Types.ResultSet where
import qualified Amazonka.Core as Core
import Amazonka.HoneyCode.Types.ColumnMetadata
import Amazonka.HoneyCode.Types.ResultRow
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ResultSet = ResultSet'
{
:: [ColumnMetadata],
ResultSet -> [ResultRow]
rows :: [ResultRow]
}
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, 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' :: [ColumnMetadata] -> [ResultRow] -> ResultSet
ResultSet'
{ $sel:headers:ResultSet' :: [ColumnMetadata]
headers = [ColumnMetadata]
forall a. Monoid a => a
Prelude.mempty,
$sel:rows:ResultSet' :: [ResultRow]
rows = [ResultRow]
forall a. Monoid a => a
Prelude.mempty
}
resultSet_headers :: Lens.Lens' ResultSet [ColumnMetadata]
= (ResultSet -> [ColumnMetadata])
-> (ResultSet -> [ColumnMetadata] -> ResultSet)
-> Lens ResultSet ResultSet [ColumnMetadata] [ColumnMetadata]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResultSet' {[ColumnMetadata]
headers :: [ColumnMetadata]
$sel:headers:ResultSet' :: ResultSet -> [ColumnMetadata]
headers} -> [ColumnMetadata]
headers) (\s :: ResultSet
s@ResultSet' {} [ColumnMetadata]
a -> ResultSet
s {$sel:headers:ResultSet' :: [ColumnMetadata]
headers = [ColumnMetadata]
a} :: ResultSet) (([ColumnMetadata] -> f [ColumnMetadata])
-> ResultSet -> f ResultSet)
-> (([ColumnMetadata] -> f [ColumnMetadata])
-> [ColumnMetadata] -> f [ColumnMetadata])
-> ([ColumnMetadata] -> f [ColumnMetadata])
-> ResultSet
-> f ResultSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ColumnMetadata] -> f [ColumnMetadata])
-> [ColumnMetadata] -> f [ColumnMetadata]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
resultSet_rows :: Lens.Lens' ResultSet [ResultRow]
resultSet_rows :: ([ResultRow] -> f [ResultRow]) -> ResultSet -> f ResultSet
resultSet_rows = (ResultSet -> [ResultRow])
-> (ResultSet -> [ResultRow] -> ResultSet)
-> Lens ResultSet ResultSet [ResultRow] [ResultRow]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResultSet' {[ResultRow]
rows :: [ResultRow]
$sel:rows:ResultSet' :: ResultSet -> [ResultRow]
rows} -> [ResultRow]
rows) (\s :: ResultSet
s@ResultSet' {} [ResultRow]
a -> ResultSet
s {$sel:rows:ResultSet' :: [ResultRow]
rows = [ResultRow]
a} :: ResultSet) (([ResultRow] -> f [ResultRow]) -> ResultSet -> f ResultSet)
-> (([ResultRow] -> f [ResultRow]) -> [ResultRow] -> f [ResultRow])
-> ([ResultRow] -> f [ResultRow])
-> ResultSet
-> f ResultSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ResultRow] -> f [ResultRow]) -> [ResultRow] -> f [ResultRow]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
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 ->
[ColumnMetadata] -> [ResultRow] -> ResultSet
ResultSet'
([ColumnMetadata] -> [ResultRow] -> ResultSet)
-> Parser [ColumnMetadata] -> Parser ([ResultRow] -> ResultSet)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe [ColumnMetadata])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"headers" Parser (Maybe [ColumnMetadata])
-> [ColumnMetadata] -> Parser [ColumnMetadata]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [ColumnMetadata]
forall a. Monoid a => a
Prelude.mempty)
Parser ([ResultRow] -> ResultSet)
-> Parser [ResultRow] -> Parser ResultSet
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [ResultRow])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"rows" Parser (Maybe [ResultRow]) -> [ResultRow] -> Parser [ResultRow]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [ResultRow]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ResultSet
instance Prelude.NFData ResultSet