message-db-0.0.1.0: Client library for Message-DB installed in PostgreSQL.
Safe HaskellNone
LanguageHaskell2010

MessageDb.Functions

Description

Synopsis

Documentation

type WithConnection = forall records. (Connection -> IO records) -> IO records Source #

data BatchSize Source #

Instances

Instances details
Eq BatchSize Source # 
Instance details

Defined in MessageDb.Functions

Show BatchSize Source # 
Instance details

Defined in MessageDb.Functions

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 -> Category -> 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.