go install github.com/favadi/protoc-go-inject-tag@latestor download the binaries from the releases page. Usage $protoc-go-inject-tag -hUsage of protoc-go-inject-tag:-XXX_skip stringtags that should be skipped (applies 'tag:"-"') for unknown fields (deprecated since protoc-gen-go v1.4....
通过对 xxx.proto 通过注释的形式加入验证 tag(使用方式文档下方有说明), 然后再使用 inject_tool.sh xxx.proto 编译, 这样生成的 xxx.pb.go 文件中的 struct 注入自定义的 tag 通过验证器对 struct 中的tag 进行验证 2. 注入工具使用 先下载本项目: go get -u gitee.com/xuesongtao/protoc-go-valid ...
https://github.com/favadi/protoc-go-inject-tag sefasenturk95, YamiOdymel, naterator, mavle, JulienBreux, aizk, r6m, yogeshpandey, liuwangchen, FOUNDXFUND, and 18 more reacted with thumbs up emoji 👍 Sorry, something went wrong. ...
https://github.com/favadi/protoc-go-inject-tag https://github.com/srikrsna/protoc-gen-gotag 有空 写下怎么用
goget github.com/favadi/protoc-go-inject-tag 2.proto文件中写注释 //file:test.proto syntax ="proto3"; package pb;messageIP { // @inject_tag: valid:"ip"stringAddress =1; } 3.生成文件 protoc --go_out=. test.proto protoc-go-inject-tag -input=./test.pb.go...
(1.)下载protoc-gen-doc⼆进制到/usr/local/bin⽬录 go get -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc (2.)⽣成proto⽂件时加⼊下⾯的参数 --doc_out=./doc --doc_opt=html,index.html protoc --doc_out=. --doc_opt=html,index.html protos/*.proto protoc -...
它们分为两种一般方法:1.使用相同的数据类型 1.使用两种不同的结构类型并在它们之间进行Map ...
它们分为两种一般方法:1.使用相同的数据类型 1.使用两种不同的结构类型并在它们之间进行Map ...
protoc-go-inject-tag-input=$name;\ done make wire cd cmd/Dyson-o2o&&wire wire:dyson-o2o/cmd/Dyson-o2o:wrote/Users/langhuaili/tools/dnmp/www/Dyson-o2o/cmd/Dyson-o2o/wire_gen.go go mod tidy go:downloading gorm.io/gen v0.2.44
protoc-go-inject-tag -input=./example/api/product/app/v1/v1.pb.go 67 changes: 64 additions & 3 deletions 67 README.md Original file line numberDiff line numberDiff line change @@ -3,11 +3,72 @@ > 修改自 [kratos v2](https://github.com/go-kratos/kratos/tree/main/cmd/protoc...