You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.7 KiB
1.7 KiB
go-zero 框架
go-zero 是一个高性能的微服务框架,简化了服务的开发和部署。
官方文档
核心特性
- 简单易用:内置代码生成工具,快速生成服务代码
- 性能强大:基于 Go 语言,支持高并发
- 完整工具链:提供 API 生成、gRPC 工具、微服务治理等
- 云原生:支持 Kubernetes、Docker 等云原生部署
项目结构
.
├── api # API 服务目录
│ ├── etc # 配置文件
│ ├── internal # 业务逻辑
│ │ ├── handler # HTTP 处理器
│ │ ├── logic # 业务逻辑
│ │ ├── svc // 服务上下文
│ │ └── types // 类型定义
│ └── main.go # 入口文件
└── rpc # gRPC 服务目录
├── etc # 配置文件
├── internal # 业务逻辑
│ ├── logic // 业务逻辑
│ └── svr // 服务器
└── *.proto # Protobuf 定义
安装
# 安装 goctl 工具
go install github.com/zeromicro/zero-tools/goctl@latest
# 创建 API 服务
goctl api new api
# 创建 gRPC 服务
goctl rpc new rpc
相关 AI 支持
- ai-context: https://github.com/zeromicro/ai-context
- mcp-zero : https://github.com/zeromicro/mcp-zero
- zero-skills : https://github.com/zeromicro/zero-skills