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.
|
|
|
# sevice-layout
|
|
|
|
|
|
|
|
微服务项目布局模板,本项目基于B站开源Kratos框架结合风芒自身基础组件封装,可以作为统一的微服务kit库,适合通用微服务项目
|
|
|
|
## 参考文档地址
|
|
|
|
https://go-kratos.dev/docs/
|
|
|
|
## 错误规范
|
|
|
|
```
|
|
|
|
{
|
|
|
|
// 错误码,跟 http-status 一致,并且在 grpc 中可以转换成 grpc-status
|
|
|
|
"code": 500,
|
|
|
|
// 错误原因,定义为业务判定错误码
|
|
|
|
"reason": "USER_NOT_FOUND",
|
|
|
|
// 错误信息,为用户可读的信息,可作为用户提示内容
|
|
|
|
"message": "invalid argument error",
|
|
|
|
// 错误元信息,为错误添加附加可扩展信息
|
|
|
|
"metadata": {
|
|
|
|
"foo": "bar"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
参考 https://go-kratos.dev/docs/component/errors
|
|
|
|
```
|
|
|
|
## 组件
|
|
|
|
### 存储
|
|
|
|
Gorm/Redis
|
|
|
|
### 服务注册发现
|
|
|
|
Nacos
|
|
|
|
### 配置中心
|
|
|
|
Nacos
|
|
|
|
### 日志
|
|
|
|
Zap
|
|
|
|
### 协议
|
|
|
|
gRPC/HTTP
|