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.1 KiB
1.1 KiB
jmproto
proto统一管理文件
初始化环境
## 在项目中初始化仓库变量
# 设置环境变量
export GIT_TERMINAL_PROMPT=1
# 绑定仓库SSH公钥
git config --global url."git.gz.internal.jumaiyx.cn:222".insteadof "https://git.gz.internal.jumaiyx.cn/"
#go env GOINSECURE="git.gz.internal.jumaiyx.cn"
# 指定仓库
go env -w GOPRIVATE="git.gz.internal.jumaiyx.cn/"
go env -w GONOSUMDB="git.gz.internal.jumaiyx.cn/"
go env -w GONOPROXY="git.gz.internal.jumaiyx.cn/"
实操参考:Kratos API定义
例子
# 生成 proto 模板
kratos proto add api/helloworld/v1/helloword.proto
# 生成 client 源码
make api file_name=helloword
支持http
PS:如果服务需要接通网关对外支持,需要提供http支持,网关会代理到grpc
#导入
import "google/api/annotations.proto";
# service层下增加以下代码:
option (google.api.http) = {
post: "/helloworld/{name}"
};
枚举类
# 常用枚举可以直接定义在error