https://github.com/totoleo/yar
Yet Another yaR client to go
https://github.com/totoleo/yar
client go rpc yar
Last synced: 2 months ago
JSON representation
Yet Another yaR client to go
- Host: GitHub
- URL: https://github.com/totoleo/yar
- Owner: totoleo
- Created: 2019-04-28T00:57:58.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-01T01:56:49.000Z (almost 7 years ago)
- Last Synced: 2024-06-20T08:17:19.322Z (almost 2 years ago)
- Topics: client, go, rpc, yar
- Language: Go
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#### Yar: Yet Another yaR client to go
-----
[Yar](https://github.com/totoleo/yar) 是一个[YAR,一个轻量级的跨语言RPC框架](https://github.com/laruence/yar)的客户端实现
#### 特性
1. 支持http客户端
2. 支持动态参数列表,但不支持默认值
-----
#### Example Client
```go
package main
import (
"context"
"fmt"
"github.com/totoleo/yar"
"github.com/totoleo/yar/client"
)
func main() {
//初始化一个客户端。
//目前仅支持http,https 的Yar服务端
c, err := client.NewClient("http://127.0.0.1:8080")
if err != nil {
fmt.Println("error", err)
}
//这是默认值
//定义Yar的服务端方法返回值
var ret interface{}
callErr := c.Call(context.TODO(),"echo", &ret)
//错误判断
if callErr != nil {
fmt.Println("error", callErr)
}
fmt.Println("data", ret)
}
```
感谢:
[weixinhost/yar.go](https://github.com/weixinhost/yar.go)
[gyf19/yar-go](https://github.com/gyf19/yar-go)