analyze protobuf
Go to file
2024-03-22 00:07:09 +08:00
.gitignore feat: api 2023-03-21 01:08:22 +08:00
example.pb.go release: new version 2024-03-19 23:38:00 +08:00
example.proto release: new version 2024-03-19 23:38:00 +08:00
go.mod release: new version 2024-03-19 23:38:00 +08:00
gobuf_test.go release: new version 2024-03-19 23:38:00 +08:00
gobuf.go fix: create file protobuf content 2024-03-22 00:07:09 +08:00
inject_tag_test.go release: new version 2024-03-19 23:38:00 +08:00
inject_tag.go release: new version 2024-03-19 23:38:00 +08:00
README.md release: new version 2024-03-19 23:38:00 +08:00
utils.go release: new version 2024-03-19 23:38:00 +08:00

gobuf

一个 protobuf 文件解析工具

用法

package main

import "gitter.top/common/gobuf"

func main() {
    parser, err := gobuf.NewParser("example.proto")
    if err != nil {
        // do something    
    }
    // 是否存在Service User
    parser.ExistService("User")
    // 是否存在Message UserAddResp
    parser.ExistMessage("UserAddResp")
    // 是否存在RPC User.Add
    parser.ExistRPC("User", "Add")
    // 添加一个RPC Update
    parser.AddRPC("User", "Update")
    // 添加一个Service Member
    parser.AddService("Member")