Safe Haskell | None |
---|---|
Language | Haskell2010 |
MessageDb.StreamName
Contents
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
- newtype StreamName = StreamName {}
- data Category
- categoryOfStream :: StreamName -> Category
- categoryToText :: Category -> Text
- category :: Text -> Category
- newtype Identifier = Identifier {}
- identifierOfStream :: StreamName -> Maybe Identifier
- addIdentifierToCategory :: Category -> Identifier -> StreamName
- addMaybeIdentifierToCategory :: Category -> Maybe Identifier -> StreamName
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
Category
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".
Identifier
newtype Identifier Source #
The identifier part of a stream name. Anything after the first hyphen (-).
Constructors
Identifier | |
Fields
|
Instances
Eq Identifier Source # | |
Defined in MessageDb.StreamName | |
Ord Identifier Source # | |
Defined in MessageDb.StreamName Methods compare :: Identifier -> Identifier -> Ordering # (<) :: Identifier -> Identifier -> Bool # (<=) :: Identifier -> Identifier -> Bool # (>) :: Identifier -> Identifier -> Bool # (>=) :: Identifier -> Identifier -> Bool # max :: Identifier -> Identifier -> Identifier # min :: Identifier -> Identifier -> Identifier # | |
Show Identifier Source # | |
Defined in MessageDb.StreamName Methods showsPrec :: Int -> Identifier -> ShowS # show :: Identifier -> String # showList :: [Identifier] -> ShowS # | |
ToJSON Identifier Source # | |
Defined in MessageDb.StreamName Methods toJSON :: Identifier -> Value # toEncoding :: Identifier -> Encoding # toJSONList :: [Identifier] -> Value # toEncodingList :: [Identifier] -> Encoding # | |
FromJSON Identifier Source # | |
Defined in MessageDb.StreamName |
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.