Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,48 @@ func main() {

更多细节可以参考 [helloworld](https://github.com/lubanproj/gorpc/tree/master/examples/helloworld)

See [helloworld](https://github.com/lubanproj/gorpc/tree/master/examples/helloworld) for more details

或者以代码生成方式调用全过程

1. 定义一个服务,这里用proto文件的形式进行定义
2. 安装protoc-gen-gorpc代码生成工具,在终端执行(前提是需要已经安装protoc工具,详情可参考protoc-gen-go安装)
3. 执行

**1. 定义一个服务,这里用proto文件的形式进行定义**

```
synax = "proto3";

package helloworld;

service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply) {}
}

message HelloRequest {
string msg = 1;
}

message HelloReply {
string msg = 1;
}

```

**2. 安装protoc-gen-gorpc代码生成工具**

```
go get github.com/lubanproj/protoc-gen-gorpc
```

**3. 执行**

```
protoc --gorpc_out=plugin:. helloworld.proto
```

更多细节可以参考 [helloworld2](https://github.com/lubanproj/gorpc/tree/master/examples/helloworld2)

### 文档

Expand Down
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,47 @@ func main() {

See [helloworld](https://github.com/lubanproj/gorpc/tree/master/examples/helloworld) for more details

Or you only need three steps to complete a service call by code generation

1. define a service by .proto file
2. install protoc-gen-gorpc for code generation
3. execute protoc

**1. define a service by .proto file**

```
synax = "proto3";

package helloworld;

service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply) {}
}

message HelloRequest {
string msg = 1;
}

message HelloReply {
string msg = 1;
}

```

**2. install protoc-gen-gorpc for code generation**

```
go get github.com/lubanproj/protoc-gen-gorpc
```

**3. execute protoc**

```
protoc --gorpc_out=plugin:. helloworld.proto
```

See [helloworld2](https://github.com/lubanproj/gorpc/tree/master/examples/helloworld2) for more details


### Documentation
- [Examples](https://github.com/lubanproj/gorpc/tree/master/examples).
Expand Down