76 lines
1.9 KiB
Go
76 lines
1.9 KiB
Go
// Code generated by protoc-gen-liverpc v0.1, DO NOT EDIT.
|
|
// source: v0/Conf.proto
|
|
|
|
/*
|
|
Package v0 is a generated liverpc stub package.
|
|
This code was generated with go-common/app/tool/liverpc/protoc-gen-liverpc v0.1.
|
|
|
|
It is generated from these files:
|
|
v0/Conf.proto
|
|
*/
|
|
package v0
|
|
|
|
import context "context"
|
|
|
|
import proto "github.com/golang/protobuf/proto"
|
|
import "go-common/library/net/rpc/liverpc"
|
|
|
|
var _ proto.Message // generate to suppress unused imports
|
|
// Imports only used by utility functions:
|
|
|
|
// ==============
|
|
// Conf Interface
|
|
// ==============
|
|
|
|
type ConfRPCClient interface {
|
|
// * 设置配置仓库
|
|
//
|
|
Set(ctx context.Context, req *ConfSetReq, opts ...liverpc.CallOption) (resp *ConfSetResp, err error)
|
|
|
|
// * 查看用户配置
|
|
//
|
|
Get(ctx context.Context, req *ConfGetReq, opts ...liverpc.CallOption) (resp *ConfGetResp, err error)
|
|
}
|
|
|
|
// ====================
|
|
// Conf Live Rpc Client
|
|
// ====================
|
|
|
|
type confRPCClient struct {
|
|
client *liverpc.Client
|
|
}
|
|
|
|
// NewConfRPCClient creates a client that implements the ConfRPCClient interface.
|
|
func NewConfRPCClient(client *liverpc.Client) ConfRPCClient {
|
|
return &confRPCClient{
|
|
client: client,
|
|
}
|
|
}
|
|
|
|
func (c *confRPCClient) Set(ctx context.Context, in *ConfSetReq, opts ...liverpc.CallOption) (*ConfSetResp, error) {
|
|
out := new(ConfSetResp)
|
|
err := doRPCRequest(ctx, c.client, 0, "Conf.set", in, out, opts)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *confRPCClient) Get(ctx context.Context, in *ConfGetReq, opts ...liverpc.CallOption) (*ConfGetResp, error) {
|
|
out := new(ConfGetResp)
|
|
err := doRPCRequest(ctx, c.client, 0, "Conf.get", in, out, opts)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// =====
|
|
// Utils
|
|
// =====
|
|
|
|
func doRPCRequest(ctx context.Context, client *liverpc.Client, version int, method string, in, out proto.Message, opts []liverpc.CallOption) (err error) {
|
|
err = client.Call(ctx, version, method, in, out, opts...)
|
|
return
|
|
}
|