77 lines
2.0 KiB
Go
77 lines
2.0 KiB
Go
// Code generated by protoc-gen-liverpc v0.1, DO NOT EDIT.
|
||
// source: v0/Message.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/Message.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:
|
||
|
||
// =================
|
||
// Message Interface
|
||
// =================
|
||
|
||
type Message interface {
|
||
// * 监控队列: topic:RoomStatusNotify-T
|
||
//
|
||
LiveNotify(context.Context, *MessageLiveNotifyReq) (*MessageLiveNotifyResp, error)
|
||
|
||
// * 监控队列: topic:OneLiveRoomAreaChange-T
|
||
//
|
||
AreaNotify(context.Context, *MessageAreaNotifyReq) (*MessageAreaNotifyResp, error)
|
||
}
|
||
|
||
// =======================
|
||
// Message Live Rpc Client
|
||
// =======================
|
||
|
||
type messageRpcClient struct {
|
||
client *liverpc.Client
|
||
}
|
||
|
||
// NewMessageRpcClient creates a Rpc client that implements the Message interface.
|
||
// It communicates using Rpc and can be configured with a custom HTTPClient.
|
||
func NewMessageRpcClient(client *liverpc.Client) Message {
|
||
return &messageRpcClient{
|
||
client: client,
|
||
}
|
||
}
|
||
|
||
func (c *messageRpcClient) LiveNotify(ctx context.Context, in *MessageLiveNotifyReq) (*MessageLiveNotifyResp, error) {
|
||
out := new(MessageLiveNotifyResp)
|
||
err := doRpcRequest(ctx, c.client, 0, "Message.liveNotify", in, out)
|
||
if err != nil {
|
||
return nil, err
|
||
}
|
||
return out, nil
|
||
}
|
||
|
||
func (c *messageRpcClient) AreaNotify(ctx context.Context, in *MessageAreaNotifyReq) (*MessageAreaNotifyResp, error) {
|
||
out := new(MessageAreaNotifyResp)
|
||
err := doRpcRequest(ctx, c.client, 0, "Message.areaNotify", in, out)
|
||
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) (err error) {
|
||
err = client.Call(ctx, version, method, in, out)
|
||
return
|
||
}
|