u
This commit is contained in:
1 parent
5ef02d648a
commit
a07052e4ca
8 files changed
+111
-6
No files matched your search
@@ -0,0 +1,26 @@
|
||||
# 项目结构
|
||||
|
||||
```
|
||||
myapp/
|
||||
├── cmd/ # 启动程序的入口(main.go 通常放在这里)
|
||||
│ └── myapp/
|
||||
│ └── main.go # 主程序入口
|
||||
│
|
||||
├── internal/ # 内部模块,不能被外部引入
|
||||
│ ├── app/ # 应用逻辑层(服务、用例)
|
||||
│ ├── config/ # 配置读取相关逻辑(如viper/yaml/env)
|
||||
│ ├── handler/ # HTTP handler(路由处理函数)
|
||||
│ ├── repository/ # 数据访问层(如数据库、缓存)
|
||||
│ ├── service/ # 业务逻辑层
|
||||
│ └── model/ # 实体结构体、DTO、表结构等
|
||||
│
|
||||
├── pkg/ # 可被外部引入的公共包
|
||||
│ ├── logger/ # 日志封装
|
||||
│ ├── utils/ # 工具函数
|
||||
│ └── middleware/ # HTTP中间件
|
||||
│
|
||||
├── go.mod # Go module 定义
|
||||
├── go.sum # Go module 校验文件
|
||||
└── README.md # 项目说明
|
||||
```
|
||||
|
||||
Reference in new issue
Block a user