Skip to content

Commit 359fa92

Browse files
authored
feat: s/Eventsourcingdb/EventSourcingDB/ (#24)
1 parent 9e4d8d7 commit 359fa92

52 files changed

Lines changed: 340 additions & 339 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ tmp/
1111
erl_crash.dump
1212
*.ez
1313
eventsourcingdb-*.tar
14+
EventSourcingDB-*.tar
1415

1516
# OS generated files and directories
1617
.DS_Store

README.md

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
# eventsourcingdb
1+
# EventSourcingDB
22

3-
The official Elixir client SDK for [EventSourcingDB](https://www.eventsourcingdb.io) – a purpose-built database for event sourcing.
3+
The official Elixir client SDK for [EventSourcingDB](https://www.EventSourcingDB.io) – a purpose-built database for event sourcing.
44

55
EventSourcingDB enables you to build and operate event-driven applications with
66
native support for writing, reading, and observing events. This client SDK
7-
provides convenient access to its capabilities in Elixir (read the [Elixir SDK documentation](https://hexdocs.pm/eventsourcingdb)).
7+
provides convenient access to its capabilities in Elixir (read the [Elixir SDK documentation](https://hexdocs.pm/EventSourcingDB)).
88

9-
For more information on EventSourcingDB, see its [official documentation](https://docs.eventsourcingdb.io/).
9+
For more information on EventSourcingDB, see its [official documentation](https://docs.EventSourcingDB.io/).
1010

1111
This client SDK includes support for [Testcontainers](https://testcontainers.com/) to spin up EventSourcingDB instances in integration tests. For details, see [Using Testcontainers](#using-testcontainers).
1212

1313
## Getting Started
1414

15-
The package can be installed by adding `eventsourcingdb` to your list of dependencies in `mix.exs`:
15+
The package can be installed by adding `EventSourcingDB` to your list of dependencies in `mix.exs`:
1616

1717
```elixir
1818
def deps do
1919
[
20-
{:eventsourcingdb, "~> 0.1.0"}
20+
{:EventSourcingDB, "~> 0.1.0"}
2121
]
2222
end
2323
```
@@ -28,7 +28,7 @@ EventSourcingDB instance:
2828
```elixir
2929
base_url = "localhost:3000"
3030
api_token = "secret"
31-
client = Eventsourcingdb.Client.new(base_url, api_token)
31+
client = EventSourcingDB.Client.new(base_url, api_token)
3232
```
3333

3434
Now every request will take the client as its first param.
@@ -38,15 +38,15 @@ Now every request will take the client as its first param.
3838
Call the `write_events` function and hand over a list with one or more events. You do not have to provide all event fields – some are automatically added by the server.
3939

4040
Specify `source`, `subject`, `type`, and `data` according to the
41-
[CloudEvents](https://docs.eventsourcingdb.io/fundamentals/cloud-events/)
41+
[CloudEvents](https://docs.EventSourcingDB.io/fundamentals/cloud-events/)
4242
format.
4343

4444
The function returns the written events, including the fields added by the
4545
server:
4646

4747
```elixir
48-
event = %Eventsourcingdb.EventCandidate{
49-
source: "https://library.eventsourcingdb.io",
48+
event = %EventSourcingDB.EventCandidate{
49+
source: "https://library.EventSourcingDB.io",
5050
subject: "/books/42",
5151
type: "io.eventsourcingdb.library.book-acquired",
5252
data: %{
@@ -56,7 +56,7 @@ event = %Eventsourcingdb.EventCandidate{
5656
}
5757
}
5858

59-
written = Eventsourcingdb.write_events(client, [event])
59+
written = EventSourcingDB.write_events(client, [event])
6060

6161
case written do
6262
{:ok, events} -> # ...
@@ -69,10 +69,10 @@ end
6969
If you only want to write events in case a subject (such as `/books/42`) does not yet have any events, use the `IsSubjectPristine` precondition to create a precondition and pass it in a vector as the second argument:
7070

7171
```elixir
72-
written = Eventsourcingdb.write_events(
72+
written = EventSourcingDB.write_events(
7373
client,
7474
[event],
75-
[%Eventsourcingdb.IsSubjectPristine{subject: "/books/42"}]
75+
[%EventSourcingDB.IsSubjectPristine{subject: "/books/42"}]
7676
)
7777

7878
case written do
@@ -86,10 +86,10 @@ end
8686
If you only want to write events in case a subject (such as `/books/42`) already has at least one event, use the `IsSubjectPopulated` precondition to create a precondition and pass it in a vector as the second argument:
8787

8888
```elixir
89-
written = Eventsourcingdb.write_events(
89+
written = EventSourcingDB.write_events(
9090
client,
9191
[event],
92-
[%Eventsourcingdb.IsSubjectPopulated{subject: "/books/42"}]
92+
[%EventSourcingDB.IsSubjectPopulated{subject: "/books/42"}]
9393
)
9494

9595
case written do
@@ -103,10 +103,10 @@ end
103103
If you only want to write events in case the last event of a subject (such as `/books/42`) has a specific ID (e.g., `0`), use the `IsSubjectOnEventId` precondition to create a precondition and pass it in a vector as the second argument:
104104

105105
```elixir
106-
written = Eventsourcingdb.write_events(
106+
written = EventSourcingDB.write_events(
107107
client,
108108
[event],
109-
[%Eventsourcingdb.IsSubjectOnEventId{subject: "/books/42", event_id: "0"}]
109+
[%EventSourcingDB.IsSubjectOnEventId{subject: "/books/42", event_id: "0"}]
110110
)
111111

112112
case written do
@@ -122,10 +122,10 @@ end
122122
If you want to write events depending on an EventQL query, use the `IsEventQLQueryTrue` precondition to create a precondition and pass it in a vector as the second argument:
123123

124124
```elixir
125-
written = Eventsourcingdb.write_events(
125+
written = EventSourcingDB.write_events(
126126
client,
127127
[event],
128-
[%Eventsourcingdb.IsEventQLQueryTrue{
128+
[%EventSourcingDB.IsEventQLQueryTrue{
129129
query: "FROM e IN events WHERE e.type == 'io.eventsourcingdb.library.book-borrowed' PROJECT INTO COUNT () < 10"
130130
}]
131131
)
@@ -144,7 +144,7 @@ subject and an options object.
144144
The function returns a stream from which you can retrieve one event at a time:
145145

146146
```elixir
147-
result = Eventsourcingdb.read_events(client, "/books/42")
147+
result = EventSourcingDB.read_events(client, "/books/42")
148148

149149
case result do
150150
{:ok, events} -> Enum.to_list(events)
@@ -157,10 +157,10 @@ end
157157
If you want to read not only all the events of a subject, but also the events of all nested subjects, set the `recursive` option to `true`:
158158

159159
```elixir
160-
result = Eventsourcingdb.read_events(
160+
result = EventSourcingDB.read_events(
161161
client,
162162
"/books/42",
163-
%Eventsourcingdb.ReadEventsOptions{recursive: true}
163+
%EventSourcingDB.ReadEventsOptions{recursive: true}
164164
)
165165
```
166166

@@ -169,10 +169,10 @@ result = Eventsourcingdb.read_events(
169169
By default, events are read in chronological order. To read in anti-chronological order, provide the `order` option and set it using the `:antichronological` ordering:
170170

171171
```elixir
172-
result = Eventsourcingdb.read_events(
172+
result = EventSourcingDB.read_events(
173173
client,
174174
"/books/42",
175-
%Eventsourcingdb.ReadEventsOptions{
175+
%EventSourcingDB.ReadEventsOptions{
176176
recursive: false,
177177
order: :antichronological
178178
}
@@ -188,16 +188,16 @@ Sometimes you do not want to read all events, but only a range of events. For th
188188
Specify the ID and whether to include or exclude it, for both the lower and upper bound:
189189

190190
```elixir
191-
result = Eventsourcingdb.read_events(
191+
result = EventSourcingDB.read_events(
192192
client,
193193
"/books/42",
194-
%Eventsourcingdb.ReadEventsOptions{
194+
%EventSourcingDB.ReadEventsOptions{
195195
recursive: false,
196-
lower_bound: %Eventsourcingdb.BoundOptions{
196+
lower_bound: %EventSourcingDB.BoundOptions{
197197
type: :inclusive,
198198
id: "100"
199199
},
200-
upper_bound: %Eventsourcingdb.BoundOptions{
200+
upper_bound: %EventSourcingDB.BoundOptions{
201201
type: :exclusive,
202202
id: "200"
203203
}
@@ -212,12 +212,12 @@ To read starting from the latest event of a given type, provide the `from_latest
212212
Possible options are `:read_nothing`, which skips reading entirely, or `:read_everything`, which effectively behaves as if `from_latest_event` was not specified:
213213

214214
```elixir
215-
result = Eventsourcingdb.read_events(
215+
result = EventSourcingDB.read_events(
216216
client,
217217
"/books/42",
218-
%Eventsourcingdb.ReadEventsOptions{
218+
%EventSourcingDB.ReadEventsOptions{
219219
recursive: false,
220-
from_latest_event: %Eventsourcingdb.FromLatestEventOptions{
220+
from_latest_event: %EventSourcingDB.FromLatestEventOptions{
221221
subject: "/books/42",
222222
type: "io.eventsourcingdb.library.book-borrowed"
223223
if_event_is_missing: :read_everything
@@ -233,7 +233,7 @@ result = Eventsourcingdb.read_events(
233233
To run an EventQL query, call the `run_eventql_query` function and provide the query as argument. The function returns a stream.
234234

235235
```elixir
236-
result = Eventsourcingdb.run_eventql_query(client, "FROM e IN events PROJECT INTO e")
236+
result = EventSourcingDB.run_eventql_query(client, "FROM e IN events PROJECT INTO e")
237237

238238
case result do
239239
{:ok, events} -> Enum.to_list(events)
@@ -248,7 +248,7 @@ To observe all events of a subject, call the `observe_events` function with the
248248
The function returns a stream from which you can retrieve one event at a time:
249249

250250
```elixir
251-
result = Eventsourcingdb.observe_events(client, "/books/42")
251+
result = EventSourcingDB.observe_events(client, "/books/42")
252252

253253
case result do
254254
{:ok, events} -> Enum.to_list(events)
@@ -261,10 +261,10 @@ end
261261
If you want to observe not only all the events of a subject, but also the events of all nested subjects, set the `recursive` option to `true`:
262262

263263
```elixir
264-
result = Eventsourcingdb.observe_events(
264+
result = EventSourcingDB.observe_events(
265265
client,
266266
"/books/42",
267-
%Eventsourcingdb.ObserveEventsOptions{
267+
%EventSourcingDB.ObserveEventsOptions{
268268
recursive: true
269269
}
270270
)
@@ -281,12 +281,12 @@ Sometimes you do not want to observe all events, but only a range of events. For
281281
Specify the ID and whether to include or exclude it:
282282

283283
```elixir
284-
result = Eventsourcingdb.observe_events(
284+
result = EventSourcingDB.observe_events(
285285
client,
286286
"/books/42",
287-
%Eventsourcingdb.ObserveEventsOptions{
287+
%EventSourcingDB.ObserveEventsOptions{
288288
recursive: false,
289-
lower_bound: %Eventsourcingdb.BoundOptions{
289+
lower_bound: %EventSourcingDB.BoundOptions{
290290
type: :inclusive,
291291
id: "100"
292292
}
@@ -301,12 +301,12 @@ To observe starting from the latest event of a given type, provide the `from_lat
301301
Possible options are `:wait_for_event`, which waits for an event of the given type to happen, or `:read_everything`, which effectively behaves as if `from_latest_event` was not specified:
302302

303303
```elixir
304-
result = Eventsourcingdb.observe_events(
304+
result = EventSourcingDB.observe_events(
305305
client,
306306
"/books/42",
307-
%Eventsourcingdb.ObserveEventsOptions{
307+
%EventSourcingDB.ObserveEventsOptions{
308308
recursive: false,
309-
from_latest_event: %Eventsourcingdb.FromLatestEventOptions{
309+
from_latest_event: %EventSourcingDB.FromLatestEventOptions{
310310
subject: "/books/42",
311311
type: "io.eventsourcingdb.library.book-borrowed",
312312
if_event_is_missing: :read_everything
@@ -322,7 +322,7 @@ result = Eventsourcingdb.observe_events(
322322
To register an event schema, call the `register_event_schema` function and hand over an event type and the desired schema:
323323

324324
```elixir
325-
Eventsourcingdb.register_event_schema(
325+
EventSourcingDB.register_event_schema(
326326
client,
327327
"io.eventsourcingdb.library.book-acquired",
328328
%{
@@ -347,7 +347,7 @@ Eventsourcingdb.register_event_schema(
347347
To list all subjects, call the `list_subjects` function with `/` as the base subject. The function returns a stream from which you can retrieve one subject at a time:
348348

349349
```elixir
350-
result = Eventsourcingdb.read_subjects(client, "/")
350+
result = EventSourcingDB.read_subjects(client, "/")
351351

352352
case result do
353353
{:ok, subjects} -> Enum.to_list(subjects)
@@ -358,15 +358,15 @@ end
358358
If you only want to list subjects within a specific branch, provide the desired base subject instead:
359359

360360
```elixir
361-
result = Eventsourcingdb.read_subjects(client, "/books")
361+
result = EventSourcingDB.read_subjects(client, "/books")
362362
```
363363

364364
## Reading a Specific Event Type
365365

366366
To list a specific event type, call the `read_event_type` function. The function returns the detailed event type, which includes the schema:
367367

368368
```elixir
369-
result = Eventsourcingdb.read_event_types(client, "io.eventsourcingdb.library.book-acquired")
369+
result = EventSourcingDB.read_event_types(client, "io.eventsourcingdb.library.book-acquired")
370370

371371
case result do
372372
{:ok, event_types} -> Enum.to_list(event_types)
@@ -390,7 +390,7 @@ Then you are ready to use the provideded `TestContainer` in your tests:
390390

391391
```elixir
392392
defmodule YourTest do
393-
alias Eventsourcingdb.TestContainer
393+
alias EventSourcingDB.TestContainer
394394
use ExUnit.Case
395395

396396
import Testcontainers.ExUnit
@@ -402,7 +402,7 @@ defmodule YourTest do
402402

403403
# do sth with client
404404

405-
assert Eventsourcingdb.ping(client) == :ok
405+
assert EventSourcingDB.ping(client) == :ok
406406
end
407407
end
408408
```

0 commit comments

Comments
 (0)