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

MessageDb.StreamName

Description

Streams are the fundamental unit of organization of evented, service-oriented systems. They are both the storage and the transport of messages in message-based systems. And they are the principle storage medium of applicative entity data.

Streams are created by writing a message to the stream. Messages are appended to the end of streams. If the stream doesn't exist when an event is appended to it, the event will be appended at position 0. If the stream already exists, the event will be appended at the next position number.

Read more at: http://docs.eventide-project.org/core-concepts/streams

Synopsis

Documentation

newtype StreamName Source #

Name of a stream. Look into categoryOfStream or identifierOfStream to parse out the category or identifier from the stream name.

Constructors

StreamName 

Fields

Instances

Instances details
Eq StreamName Source # 
Instance details

Defined in MessageDb.StreamName

Ord StreamName Source # 
Instance details

Defined in MessageDb.StreamName

Show StreamName Source # 
Instance details

Defined in MessageDb.StreamName

IsString StreamName Source # 
Instance details

Defined in MessageDb.StreamName

Semigroup StreamName Source # 
Instance details

Defined in MessageDb.StreamName

ToJSON StreamName Source # 
Instance details

Defined in MessageDb.StreamName

FromJSON StreamName Source # 
Instance details

Defined in MessageDb.StreamName

Category

data Category Source #

A Category represents everything in the StreamName up to the first hyphen (-). For example, the category for the stream name, "account-1234", is "account".

categoryOfStream :: StreamName -> Category Source #

Gets the category of a stream. For example for "account-123" it would return "account".

categoryToText :: Category -> Text Source #

Convert from a Category to a Text.

Identifier

newtype Identifier Source #

The identifier part of a stream name. Anything after the first hyphen (-).

Constructors

Identifier 

Fields

identifierOfStream :: StreamName -> Maybe Identifier Source #

Gets the identifier of a stream from a StreamName. For example "account-ed3b4af7-b4a0-499e-8a16-a09763811274" would return Just "ed3b4af7-b4a0-499e-8a16-a09763811274", and "account" would return Nothing.

addIdentifierToCategory :: Category -> Identifier -> StreamName Source #

Add an identifier to a Category. For example category "account" and identifier "123" would return "account-123".

addMaybeIdentifierToCategory :: Category -> Maybe Identifier -> StreamName Source #

Add a maybe identifier, allowing you to add an identifier to the stream name if it is Just.