Skip to content

Commit fe1a2cb

Browse files
committed
golang项目结构
1 parent 0382b6a commit fe1a2cb

File tree

30 files changed

+35
-14
lines changed

30 files changed

+35
-14
lines changed

project_layout/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
```base
2+
├── api
3+
├── cmd 项目启动文件
4+
│   └── user 项目名称
5+
│   └── main.go
6+
├── conf 配置文件
7+
│   └── user.yaml
8+
├── internal
9+
│   └── user 项目名称
10+
│   ├── adapter 适配器,对外提供不同的协议适配
11+
│   │   ├── grpc
12+
│   │   └── http
13+
│   ├── domain
14+
│   │   ├── aggregate 聚合根
15+
│   │   ├── dto 定义入参,出参
16+
│   │   ├── entity 实体
17+
│   │   ├── event 事件
18+
│   │   ├── interface 抽象接口由外部 repository 实现
19+
│   │   ├── service 领域服务
20+
│   │   └── valobj 值对象
21+
│   ├── facade 接口防腐层 调用其他服务接口
22+
│   │
23+
│   └── infrastructure 适配器,是对技术实现的适配
24+
│   └── repository 依赖倒置实现储存服务
25+
└── pkg 三方库工具类
26+
27+
28+
```
29+
30+
#### 提交空目录
31+
``` based
32+
//项目的根目录下,执行下面语句:
33+
find . -name .git -prune -o -type d -empty -exec touch {}/.gitignore \;
34+
```

project_layout/api/.gitignore

Whitespace-only changes.

project_layout/api/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

project_layout/build/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

project_layout/cmd/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

project_layout/cmd/user/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package user

project_layout/conf/user.yaml

Whitespace-only changes.

project_layout/configs/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

project_layout/internal/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

project_layout/internal/app/common/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

project_layout/internal/app/controller/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

project_layout/internal/app/entity/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

project_layout/internal/app/repository/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

project_layout/internal/app/router/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

project_layout/internal/app/router/middleware/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

project_layout/internal/app/service/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

project_layout/internal/pkg/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

project_layout/internal/user/adapter/grpc/.gitignore

Whitespace-only changes.

project_layout/internal/user/adapter/http/.gitignore

Whitespace-only changes.

project_layout/internal/user/domain/aggregate/.gitignore

Whitespace-only changes.

project_layout/internal/user/domain/dto/.gitignore

Whitespace-only changes.

project_layout/internal/user/domain/entity/.gitignore

Whitespace-only changes.

project_layout/internal/user/domain/event/.gitignore

Whitespace-only changes.

project_layout/internal/user/domain/interface/.gitignore

Whitespace-only changes.

project_layout/internal/user/domain/service/.gitignore

Whitespace-only changes.

project_layout/internal/user/domain/valobj/.gitignore

Whitespace-only changes.

project_layout/internal/user/facade/.gitignore

Whitespace-only changes.

project_layout/internal/user/infrastructure/repository/.gitignore

Whitespace-only changes.

project_layout/pkg/.gitignore

Whitespace-only changes.

project_layout/tool/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)