优化结构
This commit is contained in:
@@ -18,7 +18,8 @@
|
||||
|
||||
## system 内部保留边界
|
||||
|
||||
- `app`:组合根,汇总各模块的迁移、菜单、路由和任务贡献。
|
||||
- `app`:运行时组合根,汇总依赖注入后的路由和任务贡献。
|
||||
- `modules`:静态模块 catalog,汇总各模块迁移、菜单、API 和默认任务。
|
||||
- `modules/system`:system 模块的 Definition,声明系统表迁移。
|
||||
- `modules/integration`:integration 配置迁移和管理面贡献。
|
||||
- `modules/task`:定时任务迁移和默认任务贡献。
|
||||
@@ -44,8 +45,8 @@
|
||||
|
||||
```text
|
||||
internal/
|
||||
app/ # 组合根和 catalog
|
||||
modules/ # 业务模块定义及其模块级贡献
|
||||
app/ # 运行时组合根
|
||||
modules/ # 静态 catalog、业务模块定义及其模块级贡献
|
||||
biz/
|
||||
system/ # 系统领域
|
||||
payment/ # 支付领域
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
```text
|
||||
internal/
|
||||
app/ # 组合根、模块 catalog 和运行时组合
|
||||
modules/system/ # system 模块定义
|
||||
app/ # 运行时组合根
|
||||
modules/ # 静态 catalog 和模块定义
|
||||
modules/payment/ # payment 模块定义
|
||||
biz/ # DO、usecase、repo interface
|
||||
conf/ # 配置 proto/runtime
|
||||
@@ -40,12 +40,12 @@ internal/
|
||||
独立边界时不继续拆分。
|
||||
- 删除只转发 `pkg/protoutil` 的 `utils/configutil`。
|
||||
|
||||
## `internal/app` 为什么只保留组合代码
|
||||
## `internal/app` 为什么只保留运行时组合
|
||||
|
||||
`app/catalog.go` 是有意保留的组合根,负责组装模块、任务注册与运行时。
|
||||
system 自身的迁移、管理面和默认定时任务位于
|
||||
`modules/system/definition.go`,由模块包声明后再被 catalog 汇总。这样模块
|
||||
定义不再和应用组合逻辑混在一起,也不能误并入 `biz`、`service` 或 `data`。
|
||||
`modules/catalog.go` 是静态模块注册点,负责按依赖顺序汇总各模块
|
||||
`Definition()`;`app/runtime.go` 只负责任务注册和依赖注入后的运行时路由组合。
|
||||
这样模块定义不再和应用组合逻辑混在一起,也不能误并入 `biz`、`service` 或
|
||||
`data`。
|
||||
|
||||
Catalog 只能自动汇总静态模块贡献;新增模块若提供运行时路由或依赖型任务,仍需
|
||||
在 cmd/Wire 中显式注册,直到统一的 runtime contribution 协议落地。
|
||||
|
||||
Reference in New Issue
Block a user