quanttide / qtcloud-data-provider

Provider of QuantTide Data Cloud
0 stars 0 forks source link

升级`cruds`模块为`repositories`模块 #1

Open Guo-Zhang opened 3 months ago

Guo-Zhang commented 3 months ago

cruds模块是FastAPI官方文档提供的编程范式,带有比较强的过程式的特征。这样写的优点是比较简单易读,缺点是不容易在框架层面和架构设计层面规范设计。

这个模块和领域驱动设计的仓储(Repository)功能一致,因此我们可以把这个模块升级为仓储模块,从而更好地和我们的架构设计方法保持一致。同时,由于Flutter客户端使用BLoC架构也有类似的领域模型(我们称为Schema或者Domain Model)和仓储(Repository),这样也可以让我们的整个系统保持一致性。

如果此实践可用,则总结到网络应用手册和FastAPI手册,规范架构设计及前后端实现的方法。

Guo-Zhang commented 3 months ago

另外一种模块命名范式是遵循Event Sourcing的实践

FastAPI示例项目:https://github.com/pyeventsourcing/example-fastapi/tree/main/bankaccounts Python库:https://eventsourcing.readthedocs.io/en/stable/topics/domain.html