-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added python 3.6 to tox * Set dev version * Ignore dist by git * Merge from master * show info on django_makemigrations when running make * added index to ts field for django storage * Respect aggregate type when querying events (#25) * added pytest-watch to devel reqs * travis should test against python 3.6 * updated tox config * started fixing #24 * Fixed django implementation of get_events * fixed sqlalchemy storage get_events method * added test * added tox to devel reqs * updated travis and tox * added migration * Updated tox config * start using aggregate type everywhere * allow to pass args to pytest * fixed sqlalchemy * fixed local storage * added changelog * Renamed publish to handle_event (#27) * Renamed publish to handle_event * Updated changelog * moved test fixture to conftest * aggregate version should be 1 after first mutation * use CQ_ instead of SES_ * use own import_string * added test for aggregate version bump * rollback imports at __init__ * added ability to upcast events - fixes #26 (#30) * added ability to upcast events - fixes #26 * updated changelog * refactor * add revision when storing an event * updated "make django_makemigrations" * storages should include revision info * added test * typo * Declarative app repos (#31) * allow to define repos for app declaratively * updated changelog * declare repo * Iter all events (#34) * implemented LocalStorage.iter_all_events * updated changelog * implemented iter_all_events for Django storage * implemented iter_all_events for sqlalchemy storage * allow to replay events (fixes #22) * started working on events replays * move replay events to storage * removed unused function * better info on exception * removed unused import * fixed handler for Django test app * removed print * updated changelog * fixed issue of registering multiple mutators under base Aggregate class (#36) * upcasters should be defined at aggregate class (#37) * freeze v0.9 * upcast events when rehydrating an aggregate (#38) * replay_events should respect upcasters param (#39)
- Loading branch information
Showing
37 changed files
with
760 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.tox | ||
dist | ||
venv | ||
*.pyc | ||
*.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Release 0.9 | ||
=========== | ||
|
||
- Added ability to replay events (use `Storage.replay_events()` function) | ||
- Added ability to upcast events | ||
- `Storage.get_events` now accepts both `aggregate_type` and `aggregate_id` | ||
- Renamed `cq.handlers.publish` to `cq.handlers.handle_event` | ||
- Repositories can now be declared using `repos` dictionary at the `BaseApp` subclasses | ||
- Implemented `Storage.iter_all_events` method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from importlib import import_module | ||
|
||
|
||
# bluntly copied from Django | ||
|
||
def import_string(dotted_path): | ||
""" | ||
Import a dotted module path and return the attribute/class designated by the | ||
last name in the path. Raise ImportError if the import failed. | ||
""" | ||
try: | ||
module_path, class_name = dotted_path.rsplit('.', 1) | ||
except ValueError as err: | ||
raise ImportError("%s doesn't look like a module path" % dotted_path) from err | ||
|
||
module = import_module(module_path) | ||
|
||
try: | ||
return getattr(module, class_name) | ||
except AttributeError as err: | ||
raise ImportError('Module "%s" does not define a "%s" attribute/class' % ( | ||
module_path, class_name) | ||
) from err |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.10.3 on 2017-03-29 23:39 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
import django.utils.timezone | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('cq', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='event', | ||
name='ts', | ||
field=models.DateTimeField(db_index=True, default=django.utils.timezone.now), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from __future__ import unicode_literals | ||
from django.db import migrations, models | ||
|
||
|
||
def split_event_names(apps, schema_editor): | ||
Event = apps.get_model('cq', 'Event') | ||
for event in Event.objects.all(): | ||
event.aggregate_type, event.name = event.name.split('.', 1) | ||
event.save(update_fields=['aggregate_type', 'name']) | ||
|
||
|
||
def join_event_names(apps, schema_editor): | ||
Event = apps.get_model('cq', 'Event') | ||
for event in Event.objects.all(): | ||
event.aggregate_type, event.name = event.name.split('.', 1) | ||
event.name = '%s.%s' % (event.aggregate_type, event.name) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('cq', '0002_ts_field_index'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='event', | ||
name='aggregate_type', | ||
field=models.CharField(db_index=True, max_length=128, null=True), | ||
), | ||
migrations.RunPython(split_event_names, join_event_names), | ||
# now we can make aggregate_type non-nullable | ||
migrations.AlterField( | ||
model_name='event', | ||
name='aggregate_type', | ||
field=models.CharField(db_index=True, max_length=128), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11 on 2017-04-30 04:26 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('cq', '0003_event_aggregate_type'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='event', | ||
name='revision', | ||
field=models.PositiveIntegerField(default=1), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.