Files
go-common/README.md

47 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# GoCommon
供其他 Go 项目引用的通用工具库。对接请看:**[INTEGRATION.md](./INTEGRATION.md)**
```
git.toowon.com/jimmy/go-common
```
```bash
go env -w GOPRIVATE=git.toowon.com
go get git.toowon.com/jimmy/go-common@v1.3.0
```
## 设计
- **Factory**启动初始化一次getter 取模块对象
- **模块包**`object.Method()`(如 `log.Info``store.Upload`
- **http**:统一出参(`Handler`
- **tools / migration**:无状态或独立 CLI不经 Factory 透传
## 模块
| 包 | 说明 |
|----|------|
| `config` | JSON 配置 |
| `factory` | 入口与 lazy getter |
| `http` | 请求解析、统一响应 |
| `middleware` | CORS、日志、Recovery、限流、语种、时区 |
| `logger` | 异步日志 |
| `storage` | Local / OSS / MinIO |
| `email` / `sms` | SMTP、阿里云短信 |
| `excel` | 导出 |
| `i18n` | 多语言消息 |
| `migration` | SQL 迁移 |
| `tools` | 时间、加密、金额等 |
| `mcp` | MCP Client多 server、`ListTools`/`CallTool` |
## 文档
| 文档 | 说明 |
|------|------|
| [INTEGRATION.md](./INTEGRATION.md) | 对接手册 |
| [VERSION.md](./VERSION.md) | 版本与发布 |
| [templates/](./templates/) | server / migrate 等脚手架 |
| [config/example.json](./config/example.json) | 配置示例 |
| [examples/](./examples/) | 示例代码 |