python的cqrs和事件源框架
kant的Python项目详细描述
#康德框架
[![构建状态](https://travis-ci.org/patrickporto/kant.svg?branch=master)(https://travis ci.org/patrickporto/kant)
[![codecov.io](https://codecov.io/github/patrickporto/kant/coverage.svg?branch=master)(https://codecov.io/github/patrickporto/kant?分支=主)
[![pypi包最新版本](https://img.shields.io/pypi/v/kant.svg)(https://pypi.python.org/pypi/kant)
[![支持的版本](https://img.shields.io/pypi/pyversions/kant.svg)(https://pypi.python.org/pypi/kant)
[![支持的实现](https://img.shields.io/pypi/implementation/kant.svg)(https://pypi.python.org/pypi/kant)
aCQRS和事件源框架,对人类安全。
*sqlalchemy投影
*snapshots**[inprogress]**
kant正式支持python 3.5-3.6。
depositperformed(events.event):
amount=events.decimalfield()
````
create aggregate to apply events
```python
from kant import aggregates
class bankAccount(aggregates.aggregate):
id=aggregates.cuidfield()
owner=aggregates.charfield()
balance=aggregates.decimalfield()
def apply_bank_account_created(self,event):
self.id=event.id
self.owner=event.owner
self.balance=0
def apply_deposit_performed(self,event):
self.balance+=event.amount
````
保存kant.event store import connect中的事件
``python
await connect(user='user',password='user',database='database')
owner'john doe's,
perform deposit=depositperperperperdepositperperform(
amount=20,
bank-account=bankaccount()
bank-account.dispatch([银行账户创建,存款执行])
bank-account.save()
康德,简单地说使用[pipenv](pipenv.org)(或pip)
``` bash
$pipenv install kant
````
[![构建状态](https://travis-ci.org/patrickporto/kant.svg?branch=master)(https://travis ci.org/patrickporto/kant)
[![codecov.io](https://codecov.io/github/patrickporto/kant/coverage.svg?branch=master)(https://codecov.io/github/patrickporto/kant?分支=主)
[![pypi包最新版本](https://img.shields.io/pypi/v/kant.svg)(https://pypi.python.org/pypi/kant)
[![支持的版本](https://img.shields.io/pypi/pyversions/kant.svg)(https://pypi.python.org/pypi/kant)
[![支持的实现](https://img.shields.io/pypi/implementation/kant.svg)(https://pypi.python.org/pypi/kant)
aCQRS和事件源框架,对人类安全。
*snapshots**[inprogress]**
kant正式支持python 3.5-3.6。
depositperformed(events.event):
amount=events.decimalfield()
````
create aggregate to apply events
```python
from kant import aggregates
class bankAccount(aggregates.aggregate):
id=aggregates.cuidfield()
owner=aggregates.charfield()
balance=aggregates.decimalfield()
def apply_bank_account_created(self,event):
self.id=event.id
self.owner=event.owner
self.balance=0
def apply_deposit_performed(self,event):
self.balance+=event.amount
````
保存kant.event store import connect中的事件
``python
await connect(user='user',password='user',database='database')
owner'john doe's,
perform deposit=depositperperperperdepositperperform(
amount=20,
bank-account=bankaccount()
bank-account.dispatch([银行账户创建,存款执行])
bank-account.save()
康德,简单地说使用[pipenv](pipenv.org)(或pip)
``` bash
$pipenv install kant
````