analyze protobuf
Go to file
2023-07-23 22:22:23 +08:00
.gitignore feat: api 2023-03-21 01:08:22 +08:00
example.pb.go fix: inject tag 2023-06-25 23:02:26 +08:00
example.proto fix: inject tag 2023-06-25 23:02:26 +08:00
go.mod chore: module update 2023-07-23 22:22:23 +08:00
gobuf_test.go fix: add service and add rpc api 2023-03-21 01:29:21 +08:00
gobuf.go chore: module update 2023-07-23 22:22:23 +08:00
inject_tag_test.go fix: inject tag 2023-06-25 23:02:26 +08:00
inject_tag.go fix: inject tag 2023-06-25 23:02:26 +08:00
README.md chore: module update 2023-07-23 22:22:23 +08:00
utils.go fix: inject tag 2023-06-25 23:02:26 +08:00

gobuf

一个 protobuf 文件解析工具

用法

package main

import "gitter.top/common/gobuf"

func main() {
    parser, err := 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")