{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DataKinds #-}
module Database.EventStore.Internal.Operation.WriteEvents.Message where
import Data.Int
import Data.ProtocolBuffers
import Database.EventStore.Internal.Operation
import Database.EventStore.Internal.Prelude
import Database.EventStore.Internal.Types
data Request
= Request
{ Request -> Required 1 (Value Text)
_streamId :: Required 1 (Value Text)
, Request -> Required 2 (Value Int64)
_expectedVersion :: Required 2 (Value Int64)
, Request -> Repeated 3 (Message NewEvent)
_events :: Repeated 3 (Message NewEvent)
, Request -> Required 4 (Value Bool)
_requireMaster :: Required 4 (Value Bool)
}
deriving (forall x. Rep Request x -> Request
forall x. Request -> Rep Request x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Request x -> Request
$cfrom :: forall x. Request -> Rep Request x
Generic, Int -> Request -> ShowS
[Request] -> ShowS
Request -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Request] -> ShowS
$cshowList :: [Request] -> ShowS
show :: Request -> String
$cshow :: Request -> String
showsPrec :: Int -> Request -> ShowS
$cshowsPrec :: Int -> Request -> ShowS
Show)
instance Encode Request
newRequest :: Text
-> Int64
-> [NewEvent]
-> Bool
-> Request
newRequest :: Text -> Int64 -> [NewEvent] -> Bool -> Request
newRequest Text
stream_id Int64
exp_ver [NewEvent]
evts Bool
req_master =
Request
{ _streamId :: Required 1 (Value Text)
_streamId = forall a. HasField a => FieldType a -> a
putField Text
stream_id
, _expectedVersion :: Required 2 (Value Int64)
_expectedVersion = forall a. HasField a => FieldType a -> a
putField Int64
exp_ver
, _events :: Repeated 3 (Message NewEvent)
_events = forall a. HasField a => FieldType a -> a
putField [NewEvent]
evts
, _requireMaster :: Required 4 (Value Bool)
_requireMaster = forall a. HasField a => FieldType a -> a
putField Bool
req_master
}
data Response
= Response
{ Response -> Required 1 (Enumeration OpResult)
_result :: Required 1 (Enumeration OpResult)
, Response -> Optional 2 (Value Text)
_message :: Optional 2 (Value Text)
, Response -> Required 3 (Value Int64)
_firstNumber :: Required 3 (Value Int64)
, Response -> Required 4 (Value Int64)
_lastNumber :: Required 4 (Value Int64)
, Response -> Optional 5 (Value Int64)
_preparePosition :: Optional 5 (Value Int64)
, Response -> Optional 6 (Value Int64)
_commitPosition :: Optional 6 (Value Int64)
}
deriving (forall x. Rep Response x -> Response
forall x. Response -> Rep Response x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Response x -> Response
$cfrom :: forall x. Response -> Rep Response x
Generic, Int -> Response -> ShowS
[Response] -> ShowS
Response -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Response] -> ShowS
$cshowList :: [Response] -> ShowS
show :: Response -> String
$cshow :: Response -> String
showsPrec :: Int -> Response -> ShowS
$cshowsPrec :: Int -> Response -> ShowS
Show)
instance Decode Response