event_source 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -2
- data/README.md +19 -1
- data/lib/event_source/event_repository.rb +5 -0
- data/lib/event_source/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99615d0ee1b5991859cd7fdcf7b4058517131dc7
|
4
|
+
data.tar.gz: 51a0eb2bb11c880fb8b7387c03c8ccd155911c9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfda1b68846dddf94ceae003bcf142075a09adc4258be3ec6ed58efc481faa29272cd2c057214f8b2cf09d7e27af545786c63ce70e0b1e9af5aeb85da994f0f8
|
7
|
+
data.tar.gz: 71214026651276cfdb88ad0a545b636f645c658eaecb9e565ab9fdf3887538a074112fbddf794264c8d6c44481e987d01c94aea7f899b44712eb69631bb5eef0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# changes
|
2
2
|
|
3
|
-
## version 0.1.
|
3
|
+
## version 0.1.3
|
4
4
|
|
5
|
-
|
5
|
+
Include entities
|
6
|
+
Extend entities
|
7
|
+
Provide on_event meta method
|
8
|
+
rebuild entities based on events
|
9
|
+
provide in_memory sqlite3 event store
|
10
|
+
|
11
|
+
## version 0.1.4
|
12
|
+
can specify a connection string to connect to an existing database
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ This library is an implementation of the Event Sourcing pattern, where instead o
|
|
4
4
|
|
5
5
|
## The event repository
|
6
6
|
|
7
|
-
An event store must be initialized. Currently, only the
|
7
|
+
An event store must be initialized. Currently, only SQL based databases accessible via the Sequel gem can be used.
|
8
8
|
|
9
9
|
```ruby
|
10
10
|
EventSource::EventRepository.create(in_memory: true)
|
@@ -16,6 +16,24 @@ Once initialized, the event repository is memoized and can be retrieved with:
|
|
16
16
|
EventSource::EventRepository.current
|
17
17
|
```
|
18
18
|
|
19
|
+
### Connecting to an existing database
|
20
|
+
Alternatively, you will probably need to connect to an existing database.
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
EventSource::EventRepository.create(connect: {connection_string: 'sqlite://events.db'})
|
24
|
+
```
|
25
|
+
|
26
|
+
### Schema
|
27
|
+
|
28
|
+
In the event you connect to an existing database, the EventRepository will expect the database to contain a table called "events" with the following schema:
|
29
|
+
|
30
|
+
* primary key: id
|
31
|
+
* string: name
|
32
|
+
* string: entity_id
|
33
|
+
* string: entity_type
|
34
|
+
* time: created_at
|
35
|
+
* string: data
|
36
|
+
|
19
37
|
## Your entities
|
20
38
|
|
21
39
|
An entity is an object that you intend to persist. You must extend and include some class methods and instance methods. Let's create an entity called BankAccount.
|
data/lib/event_source/version.rb
CHANGED