Files
Inbox/Go项目实战/03_基础设施/01_错误处理/04_错误处理模块文件夹骨架.md
2025-12-11 07:24:36 +08:00

1.3 KiB

tags, date created, date modified
tags date created date modified
星期三, 十二月 10日 2025, 11:00:25 上午 星期三, 十二月 10日 2025, 11:56:10 中午
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