Safe Haskell | None |
---|---|
Language | Haskell2010 |
Provides access to the functions described at http://docs.eventide-project.org/user-guide/message-db/server-functions.html
Synopsis
- type WithConnection = forall records. (Connection -> IO records) -> IO records
- data BatchSize
- newtype Condition = Condition {}
- data ConsumerGroup = ConsumerGroup {}
- newtype Correlation = Correlation {}
- data StreamVersion
- newtype ExpectedVersion = ExpectedVersion {}
- newtype ExpectedVersionViolation = ExpectedVersionViolation {}
- parseExpectedVersionViolation :: SqlError -> Maybe ExpectedVersionViolation
- lookupById :: Connection -> MessageId -> IO (Maybe Message)
- lookupByPosition :: Connection -> GlobalPosition -> IO (Maybe Message)
- writeMessage :: (ToJSON payload, ToJSON metadata) => Connection -> StreamName -> MessageType -> payload -> Maybe metadata -> Maybe ExpectedVersion -> IO (MessageId, StreamPosition)
- getStreamMessages :: Connection -> StreamName -> Maybe StreamPosition -> Maybe BatchSize -> Maybe Condition -> IO [Message]
- getCategoryMessages :: Connection -> CategoryName -> Maybe GlobalPosition -> Maybe BatchSize -> Maybe Correlation -> Maybe ConsumerGroup -> Maybe Condition -> IO [Message]
- getLastStreamMessage :: Connection -> StreamName -> IO (Maybe Message)
- streamVersion :: Connection -> StreamName -> IO (Maybe StreamPosition)
Documentation
type WithConnection = forall records. (Connection -> IO records) -> IO records Source #
Instances
data ConsumerGroup Source #
Instances
Eq ConsumerGroup Source # | |
Defined in MessageDb.Functions (==) :: ConsumerGroup -> ConsumerGroup -> Bool # (/=) :: ConsumerGroup -> ConsumerGroup -> Bool # | |
Show ConsumerGroup Source # | |
Defined in MessageDb.Functions showsPrec :: Int -> ConsumerGroup -> ShowS # show :: ConsumerGroup -> String # showList :: [ConsumerGroup] -> ShowS # |
newtype Correlation Source #
Instances
data StreamVersion Source #
Instances
Eq StreamVersion Source # | |
Defined in MessageDb.Functions (==) :: StreamVersion -> StreamVersion -> Bool # (/=) :: StreamVersion -> StreamVersion -> Bool # | |
Ord StreamVersion Source # | |
Defined in MessageDb.Functions compare :: StreamVersion -> StreamVersion -> Ordering # (<) :: StreamVersion -> StreamVersion -> Bool # (<=) :: StreamVersion -> StreamVersion -> Bool # (>) :: StreamVersion -> StreamVersion -> Bool # (>=) :: StreamVersion -> StreamVersion -> Bool # max :: StreamVersion -> StreamVersion -> StreamVersion # min :: StreamVersion -> StreamVersion -> StreamVersion # | |
Show StreamVersion Source # | |
Defined in MessageDb.Functions showsPrec :: Int -> StreamVersion -> ShowS # show :: StreamVersion -> String # showList :: [StreamVersion] -> ShowS # |
newtype ExpectedVersion Source #
Instances
Eq ExpectedVersion Source # | |
Defined in MessageDb.Functions (==) :: ExpectedVersion -> ExpectedVersion -> Bool # (/=) :: ExpectedVersion -> ExpectedVersion -> Bool # | |
Ord ExpectedVersion Source # | |
Defined in MessageDb.Functions compare :: ExpectedVersion -> ExpectedVersion -> Ordering # (<) :: ExpectedVersion -> ExpectedVersion -> Bool # (<=) :: ExpectedVersion -> ExpectedVersion -> Bool # (>) :: ExpectedVersion -> ExpectedVersion -> Bool # (>=) :: ExpectedVersion -> ExpectedVersion -> Bool # max :: ExpectedVersion -> ExpectedVersion -> ExpectedVersion # min :: ExpectedVersion -> ExpectedVersion -> ExpectedVersion # | |
Show ExpectedVersion Source # | |
Defined in MessageDb.Functions showsPrec :: Int -> ExpectedVersion -> ShowS # show :: ExpectedVersion -> String # showList :: [ExpectedVersion] -> ShowS # |
newtype ExpectedVersionViolation Source #
Instances
Eq ExpectedVersionViolation Source # | |
Defined in MessageDb.Functions | |
Show ExpectedVersionViolation Source # | |
Defined in MessageDb.Functions showsPrec :: Int -> ExpectedVersionViolation -> ShowS # show :: ExpectedVersionViolation -> String # showList :: [ExpectedVersionViolation] -> ShowS # | |
Exception ExpectedVersionViolation Source # | |
lookupById :: Connection -> MessageId -> IO (Maybe Message) Source #
lookupByPosition :: Connection -> GlobalPosition -> IO (Maybe Message) Source #
writeMessage :: (ToJSON payload, ToJSON metadata) => Connection -> StreamName -> MessageType -> payload -> Maybe metadata -> Maybe ExpectedVersion -> IO (MessageId, StreamPosition) Source #
Write a JSON-formatted message to a named stream, optionally specifying JSON-formatted metadata and an expected version number.
getStreamMessages :: Connection -> StreamName -> Maybe StreamPosition -> Maybe BatchSize -> Maybe Condition -> IO [Message] Source #
Retrieve messages from a single stream, optionally specifying the starting position, the number of messages to retrieve, and an additional condition that will be appended to the SQL command's WHERE clause.
getCategoryMessages :: Connection -> CategoryName -> Maybe GlobalPosition -> Maybe BatchSize -> Maybe Correlation -> Maybe ConsumerGroup -> Maybe Condition -> IO [Message] Source #
Retrieve messages from a category of streams, optionally specifying the starting position, the number of messages to retrieve, the correlation category for Pub/Sub, consumer group parameters, and an additional condition that will be appended to the SQL command's WHERE clause.
getLastStreamMessage :: Connection -> StreamName -> IO (Maybe Message) Source #
Row from the messages table that corresponds to the highest position number in the stream.
streamVersion :: Connection -> StreamName -> IO (Maybe StreamPosition) Source #
Highest position number in the stream.