创建仓库
This commit is contained in:
27
Go项目实战/03_基础设施/01_错误处理/04_错误处理模块文件夹骨架.md
Normal file
27
Go项目实战/03_基础设施/01_错误处理/04_错误处理模块文件夹骨架.md
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
tags: []
|
||||
date created: 星期三, 十二月 10日 2025, 11:00:25 上午
|
||||
date modified: 星期三, 十二月 10日 2025, 11:56:10 中午
|
||||
---
|
||||
|
||||
```plaintext
|
||||
enterprise-cms-core/
|
||||
├── internal/
|
||||
│ ├── pkg/
|
||||
│ │ ├── ecode/ # [Level 0] 基础领域层
|
||||
│ │ │ ├── code.go # [Const] 纯常量定义 (ErrorCode Registry)
|
||||
│ │ │ ├── error.go # [Type] 核心结构体定义 (struct Error)
|
||||
│ │ │ ├── msg.go # [Data] 错误码文案映射 (var msg map[int]string)
|
||||
│ │ │ └── ecode_test.go # [Test] 单元测试
|
||||
│ │ │
|
||||
│ │ └── app/ # [Level 1] 应用工具层
|
||||
│ │ ├── responder.go # [Interface] 👈 修正点: 定义 type Responder interface
|
||||
│ │ ├── response.go # [Impl] 定义 type Response struct (实现逻辑)
|
||||
│ │ ├── options.go # [Pattern] 定义 Functional Options (配置扩展)
|
||||
│ │ └── response_test.go # [Test] 单元测试
|
||||
│ │
|
||||
│ └── middleware/ # [Global]
|
||||
│ ├── recovery.go # Panic 捕获
|
||||
│ ├── not_found.go # 404 处理
|
||||
│ └── metrics.go
|
||||
```
|
||||
Reference in New Issue
Block a user