{-# LANGUAGE ScopedTypeVariables, DataKinds, TypeFamilies,
UndecidableInstances, GeneralizedNewtypeDeriving,
MultiParamTypeClasses, FlexibleContexts, FlexibleInstances,
PatternSynonyms, MagicHash, NoImplicitPrelude, DataKinds,
BangPatterns, TypeApplications #-}
{-# OPTIONS_GHC -fno-warn-unused-imports#-}
{-# OPTIONS_GHC -fno-warn-duplicate-exports#-}
module Proto.Vendored.Google.Protobuf.Timestamp (Timestamp()) where
import qualified Data.ProtoLens.Runtime.Control.DeepSeq
as Control.DeepSeq
import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Prism
as Data.ProtoLens.Prism
import qualified Data.ProtoLens.Runtime.Prelude as Prelude
import qualified Data.ProtoLens.Runtime.Data.Int as Data.Int
import qualified Data.ProtoLens.Runtime.Data.Monoid as Data.Monoid
import qualified Data.ProtoLens.Runtime.Data.Word as Data.Word
import qualified Data.ProtoLens.Runtime.Data.ProtoLens
as Data.ProtoLens
import qualified
Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Bytes
as Data.ProtoLens.Encoding.Bytes
import qualified
Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Growing
as Data.ProtoLens.Encoding.Growing
import qualified
Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Parser.Unsafe
as Data.ProtoLens.Encoding.Parser.Unsafe
import qualified
Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Wire
as Data.ProtoLens.Encoding.Wire
import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Field
as Data.ProtoLens.Field
import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Message.Enum
as Data.ProtoLens.Message.Enum
import qualified
Data.ProtoLens.Runtime.Data.ProtoLens.Service.Types
as Data.ProtoLens.Service.Types
import qualified Data.ProtoLens.Runtime.Lens.Family2
as Lens.Family2
import qualified Data.ProtoLens.Runtime.Lens.Family2.Unchecked
as Lens.Family2.Unchecked
import qualified Data.ProtoLens.Runtime.Data.Text as Data.Text
import qualified Data.ProtoLens.Runtime.Data.Map as Data.Map
import qualified Data.ProtoLens.Runtime.Data.ByteString
as Data.ByteString
import qualified Data.ProtoLens.Runtime.Data.ByteString.Char8
as Data.ByteString.Char8
import qualified Data.ProtoLens.Runtime.Data.Text.Encoding
as Data.Text.Encoding
import qualified Data.ProtoLens.Runtime.Data.Vector as Data.Vector
import qualified Data.ProtoLens.Runtime.Data.Vector.Generic
as Data.Vector.Generic
import qualified Data.ProtoLens.Runtime.Data.Vector.Unboxed
as Data.Vector.Unboxed
import qualified Data.ProtoLens.Runtime.Text.Read as Text.Read
data Timestamp = Timestamp{_Timestamp'seconds :: !Data.Int.Int64,
_Timestamp'nanos :: !Data.Int.Int32,
_Timestamp'_unknownFields :: !Data.ProtoLens.FieldSet}
deriving (Prelude.Eq, Prelude.Ord)
instance Prelude.Show Timestamp where
showsPrec _ __x __s
= Prelude.showChar '{'
(Prelude.showString (Data.ProtoLens.showMessageShort __x)
(Prelude.showChar '}' __s))
instance Data.ProtoLens.Field.HasField Timestamp "seconds"
(Data.Int.Int64)
where
fieldOf _
= (Lens.Family2.Unchecked.lens _Timestamp'seconds
(\ x__ y__ -> x__{_Timestamp'seconds = y__}))
Prelude.. Prelude.id
instance Data.ProtoLens.Field.HasField Timestamp "nanos"
(Data.Int.Int32)
where
fieldOf _
= (Lens.Family2.Unchecked.lens _Timestamp'nanos
(\ x__ y__ -> x__{_Timestamp'nanos = y__}))
Prelude.. Prelude.id
instance Data.ProtoLens.Message Timestamp where
messageName _ = Data.Text.pack "google.protobuf.Timestamp"
fieldsByTag
= let seconds__field_descriptor
= Data.ProtoLens.FieldDescriptor "seconds"
(Data.ProtoLens.ScalarField Data.ProtoLens.Int64Field ::
Data.ProtoLens.FieldTypeDescriptor Data.Int.Int64)
(Data.ProtoLens.PlainField Data.ProtoLens.Optional
(Data.ProtoLens.Field.field @"seconds"))
:: Data.ProtoLens.FieldDescriptor Timestamp
nanos__field_descriptor
= Data.ProtoLens.FieldDescriptor "nanos"
(Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field ::
Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32)
(Data.ProtoLens.PlainField Data.ProtoLens.Optional
(Data.ProtoLens.Field.field @"nanos"))
:: Data.ProtoLens.FieldDescriptor Timestamp
in
Data.Map.fromList
[(Data.ProtoLens.Tag 1, seconds__field_descriptor),
(Data.ProtoLens.Tag 2, nanos__field_descriptor)]
unknownFields
= Lens.Family2.Unchecked.lens _Timestamp'_unknownFields
(\ x__ y__ -> x__{_Timestamp'_unknownFields = y__})
defMessage
= Timestamp{_Timestamp'seconds = Data.ProtoLens.fieldDefault,
_Timestamp'nanos = Data.ProtoLens.fieldDefault,
_Timestamp'_unknownFields = ([])}
parseMessage
= let loop ::
Timestamp -> Data.ProtoLens.Encoding.Bytes.Parser Timestamp
loop x
= do end <- Data.ProtoLens.Encoding.Bytes.atEnd
if end then
do let missing = [] in
if Prelude.null missing then Prelude.return () else
Prelude.fail
(("Missing required fields: ") Prelude.++
Prelude.show (missing :: ([Prelude.String])))
Prelude.return
(Lens.Family2.over Data.ProtoLens.unknownFields
(\ !t -> Prelude.reverse t)
x)
else
do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt
case tag of
8 -> do y <- (Prelude.fmap Prelude.fromIntegral
Data.ProtoLens.Encoding.Bytes.getVarInt)
Data.ProtoLens.Encoding.Bytes.<?> "seconds"
loop
(Lens.Family2.set (Data.ProtoLens.Field.field @"seconds")
y
x)
16 -> do y <- (Prelude.fmap Prelude.fromIntegral
Data.ProtoLens.Encoding.Bytes.getVarInt)
Data.ProtoLens.Encoding.Bytes.<?> "nanos"
loop
(Lens.Family2.set (Data.ProtoLens.Field.field @"nanos") y
x)
wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire
wire
loop
(Lens.Family2.over Data.ProtoLens.unknownFields
(\ !t -> (:) y t)
x)
in
(do loop Data.ProtoLens.defMessage)
Data.ProtoLens.Encoding.Bytes.<?> "Timestamp"
buildMessage
= (\ _x ->
(let _v
= Lens.Family2.view (Data.ProtoLens.Field.field @"seconds") _x
in
if (_v) Prelude.== Data.ProtoLens.fieldDefault then
Data.Monoid.mempty else
(Data.ProtoLens.Encoding.Bytes.putVarInt 8) Data.Monoid.<>
((Data.ProtoLens.Encoding.Bytes.putVarInt) Prelude..
Prelude.fromIntegral)
_v)
Data.Monoid.<>
(let _v
= Lens.Family2.view (Data.ProtoLens.Field.field @"nanos") _x
in
if (_v) Prelude.== Data.ProtoLens.fieldDefault then
Data.Monoid.mempty else
(Data.ProtoLens.Encoding.Bytes.putVarInt 16) Data.Monoid.<>
((Data.ProtoLens.Encoding.Bytes.putVarInt) Prelude..
Prelude.fromIntegral)
_v)
Data.Monoid.<>
Data.ProtoLens.Encoding.Wire.buildFieldSet
(Lens.Family2.view Data.ProtoLens.unknownFields _x))
instance Control.DeepSeq.NFData Timestamp where
rnf
= (\ x__ ->
Control.DeepSeq.deepseq (_Timestamp'_unknownFields x__)
(Control.DeepSeq.deepseq (_Timestamp'seconds x__)
(Control.DeepSeq.deepseq (_Timestamp'nanos x__) (()))))