ExESDB.Gateway (ex_esdb v0.0.9-alpha)

Provides API functions for working with ExESDB ## API

- append_events/4
- get_events/4
- get_streams/1

- add_subscription/4
- subscribe_to/5
- unsubscribe/2
- delete_subscription/4

Summary

Types

error()

@type error() :: term()

selector_type()

@type selector_type() :: String.t() | map()

store()

@type store() :: atom()

stream()

@type stream() :: String.t()

subscription_name()

@type subscription_name() :: String.t()

subscription_type()

@type subscription_type() :: :by_stream | :by_event_type | :by_event_pattern

Functions

add_subscription(store, type, selector, subscription_name \\ "transient", subscriber \\ nil, start_from \\ 0)

@spec add_subscription(
  store :: store(),
  type :: subscription_type(),
  selector :: selector_type(),
  subscription_name :: subscription_name(),
  subscriber :: pid() | nil,
  start_from :: integer()
) :: :ok | {:error, error()}

Add a subscription.

append_events(store, stream_id, events)

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_events(store, stream_id, start_version, count, direction \\ :forward)

get_streams(store)

@spec get_streams(store :: atom()) :: {:ok, list()} | {:error, term()}

Get all streams from the store. ## Parameters

- store: the id of the store

## Returns

- a list of all streams in the store

get_subscriptions(store)

remove_subscription(store, type, selector, subscription_name \\ "transient")

@spec remove_subscription(
  store :: any(),
  type :: subscription_type(),
  selector :: selector_type(),
  subscription_name :: subscription_name()
) :: :ok | {:error, error()}

Delete a subscription.

start_link(opts)