protoc-gen-go-dracarys

command module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2021 License: MIT Imports: 8 Imported by: 0

README

protoc-gen-go-dracarys

一个protobuf编译器插件,设计用于Dracarys框架的代码生成。

先决条件

  1. protobuf编译器

    请自行安装protoc编译器。

    安装地址

  2. Golang Protobuf代码生成器

    获取golang protobuf代码生成器:

    go get -u github.com/golang/protobuf/protoc-gen-go
    

安装

  • 方式一

    go get -u github.com/merenguessss/protoc-gen-go-dracarys
    
  • 方式二

    git clone git@github.com:merenguessss/protoc-gen-go-dracarys.git
    git install
    

快速开始

  1. 编写protobuf文件

    例:

    syntax = "proto3";
    
    package helloworld;
    option go_package="/helloworld";
    
    service Greeter {
        rpc SayHello (HelloRequest) returns (HelloReply) {}
    }
    
    message HelloRequest {
        string msg = 1;
    }
    
    message HelloReply {
        string msg = 1;
    }
    
  2. 执行命令生成 pb.go 文件

    protoc --go-dracarys_out=. helloworld.proto
    

    一个Dracarys框架所需的代码就生成了。😝

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL