2 Star 0 Fork 0

mirrors_confluentinc/proto-go-setter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT
# proto-go-setter Add setters for generated message fields. Supports scalar values (string, int32, etc) and maps with primitive types for both key and value. This is an often-requested feature for protoc-gen-go that won't be added to the core generator. See: * https://github.com/golang/protobuf/issues/65 * https://github.com/golang/protobuf/issues/664 ## Example The simplest option is to just generate a setter for a single field. ```proto syntax = "proto3"; import "github.com/confluentinc/proto-go-setter/setter.proto"; message Person { string id = 1; string name = 2 [(setter.include)=true]; } ``` Alternatively, you may want to generate setters for all fields in a message, or all fields _except_ a single field. ```proto syntax = "proto3"; import "github.com/confluentinc/proto-go-setter/setter.proto"; message Person { option (setter.all_fields) = true; string id = 1 [(setter.exclude)=true]; string name = 2; } ``` Lastly, you may want to generate setters for everything in a file. ```proto syntax = "proto3"; import "github.com/confluentinc/proto-go-setter/setter.proto"; option (setter.all_messages) = true; message Person { string id = 1 [(setter.exclude)=true]; string name = 2; } ``` You'd generate the setters code by running ```bash $ protoc --setter_out=. person.proto ``` All three examples above would result in `person_setter.go` containing ```go func (t *Person) SetName(name string) { t.Name = name } ``` ## LICENSE MIT --- - [codyaray.com](http://codyaray.com) - GitHub [@codyaray](https://github.com/codyaray) - LinkedIn [@codyaray](https://linkedin.com/in/codyaray)

简介

暂无描述 展开 收起
Go 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_confluentinc/proto-go-setter.git
git@gitee.com:mirrors_confluentinc/proto-go-setter.git
mirrors_confluentinc
proto-go-setter
proto-go-setter
master

搜索帮助