代码拉取完成,页面将自动刷新
// Machine generated code
// Code generated by go-idl-tool. DO NOT EDIT 2022-03-17 11:34:04
// source: TestCaller
package example
import (
"context"
"errors"
"gitee.com/dennis-kk/rpc-go-backend/idlrpc/example/pbdata"
"gitee.com/dennis-kk/rpc-go-backend/idlrpc"
"github.com/golang/protobuf/proto"
)
type TestCallerStub struct {
srvImpl ITestCaller
}
func NewTestCallerStub(srvImpl ITestCaller) *TestCallerStub {
return &TestCallerStub{
srvImpl,
}
}
func TestCallerStubCreator(v interface{}) idlrpc.IStub {
if service, ok := v.(ITestCaller); ok {
return &TestCallerStub{
service,
}
}
return nil
}
func (sb *TestCallerStub) GetUUID() idlrpc.SvcUuid {
return SrvUUID
}
func (sb *TestCallerStub) GetServiceName() string {
return SrvName
}
func (sb *TestCallerStub) GetSignature(methodid uint32) string {
var sign string
switch methodid {
case 1:
sign = "SetInfo"
case 2:
sign = "GetInfo"
}
return sign
}
func (sb *TestCallerStub) GetMutipleNum() uint32 {
return 0
}
func (sb *TestCallerStub) OnAfterFork(ctx context.Context) bool {
return sb.srvImpl.OnAfterFork(ctx)
}
func (sb *TestCallerStub) OnTick() bool {
return sb.srvImpl.OnTick()
}
func (sb *TestCallerStub) OnBeforeDestroy() bool {
return sb.srvImpl.OnBeforeDestroy()
}
func (sb *TestCallerStub) GetStatus() idlrpc.ServiceStatus {
return idlrpc.SERVICE_RESOLVED
}
func (sb *TestCallerStub) SetStatus(status idlrpc.ServiceStatus) {
}
func (sb *TestCallerStub) Call(ctx context.Context, methodId uint32, req []byte) (resp []byte, err error) {
//解析header
switch methodId {
case 1:
resp, err = sb.SetInfo(ctx, req)
case 2:
resp, err = sb.GetInfo(ctx, req)
default:
err = errors.New("Method Not Fount!!!!!")
}
return
}
func (sb *TestCallerStub) IsOneWay(methodid uint32) (isoneway bool) {
switch methodid {
case 1:
isoneway = false
case 2:
isoneway = false
default:
isoneway = false
}
return
}
func (sb *TestCallerStub) SetInfo(ctx context.Context, req []byte) (resp []byte, err error) {
if sb == nil {
err = errors.New(SrvName + "Service is not Regist")
return
}
if req == nil {
err = errors.New("Request Function Is InValid")
return
}
//解包协议
pbreq := &pbdata.TestCaller_SetInfoArgs{}
err = proto.Unmarshal(req, pbreq)
if err != nil {
return
}
_1 := pbreq.Arg1
err = sb.srvImpl.SetInfo(ctx, _1)
//构造返回值
return
}
func (sb *TestCallerStub) GetInfo(ctx context.Context, req []byte) (resp []byte, err error) {
if sb == nil {
err = errors.New(SrvName + "Service is not Regist")
return
}
if req == nil {
err = errors.New("Request Function Is InValid")
return
}
//解包协议
pbreq := &pbdata.TestCaller_GetInfoArgs{}
err = proto.Unmarshal(req, pbreq)
if err != nil {
return
}
ret, err := sb.srvImpl.GetInfo(ctx)
//构造返回值
pbret := &pbdata.TestCaller_GetInfoRet{}
pbret.Ret1 = ret
resp, err = proto.Marshal(pbret)
return
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。