150 lines
5.7 KiB
Go
150 lines
5.7 KiB
Go
// Code generated by protoc-gen-triple. DO NOT EDIT.
|
|
//
|
|
// Source: starbook.proto
|
|
package starbook
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
import (
|
|
"dubbo.apache.org/dubbo-go/v3"
|
|
"dubbo.apache.org/dubbo-go/v3/client"
|
|
"dubbo.apache.org/dubbo-go/v3/common"
|
|
"dubbo.apache.org/dubbo-go/v3/common/constant"
|
|
"dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol"
|
|
"dubbo.apache.org/dubbo-go/v3/server"
|
|
)
|
|
|
|
// This is a compile-time assertion to ensure that this generated file and the Triple package
|
|
// are compatible. If you get a compiler error that this constant is not defined, this code was
|
|
// generated with a version of Triple newer than the one compiled into your binary. You can fix the
|
|
// problem by either regenerating this code with an older version of Triple or updating the Triple
|
|
// version compiled into your binary.
|
|
const _ = triple_protocol.IsAtLeastVersion0_1_0
|
|
|
|
const (
|
|
// StarbookServiceName is the fully-qualified name of the StarbookService service.
|
|
StarbookServiceName = "topfans.starbook.StarbookService"
|
|
)
|
|
|
|
// These constants are the fully-qualified names of the RPCs defined in this package. They're
|
|
// exposed at runtime as procedure and as the final two segments of the HTTP route.
|
|
//
|
|
// Note that these are different from the fully-qualified method names used by
|
|
// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
|
|
// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
|
|
// period.
|
|
const (
|
|
// StarbookServiceGetStarbookHomeProcedure is the fully-qualified name of the StarbookService's GetStarbookHome RPC.
|
|
StarbookServiceGetStarbookHomeProcedure = "/topfans.starbook.StarbookService/GetStarbookHome"
|
|
// StarbookServiceGetStarbookItemsProcedure is the fully-qualified name of the StarbookService's GetStarbookItems RPC.
|
|
StarbookServiceGetStarbookItemsProcedure = "/topfans.starbook.StarbookService/GetStarbookItems"
|
|
)
|
|
|
|
var (
|
|
_ StarbookService = (*StarbookServiceImpl)(nil)
|
|
)
|
|
|
|
// StarbookService is a client for the topfans.starbook.StarbookService service.
|
|
type StarbookService interface {
|
|
GetStarbookHome(ctx context.Context, req *GetStarbookHomeRequest, opts ...client.CallOption) (*GetStarbookHomeResponse, error)
|
|
GetStarbookItems(ctx context.Context, req *GetStarbookItemsRequest, opts ...client.CallOption) (*GetStarbookItemsResponse, error)
|
|
}
|
|
|
|
// NewStarbookService constructs a client for the starbook.StarbookService service.
|
|
func NewStarbookService(cli *client.Client, opts ...client.ReferenceOption) (StarbookService, error) {
|
|
conn, err := cli.DialWithInfo("topfans.starbook.StarbookService", &StarbookService_ClientInfo, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &StarbookServiceImpl{
|
|
conn: conn,
|
|
}, nil
|
|
}
|
|
|
|
func SetConsumerStarbookService(srv common.RPCService) {
|
|
dubbo.SetConsumerServiceWithInfo(srv, &StarbookService_ClientInfo)
|
|
}
|
|
|
|
// StarbookServiceImpl implements StarbookService.
|
|
type StarbookServiceImpl struct {
|
|
conn *client.Connection
|
|
}
|
|
|
|
func (c *StarbookServiceImpl) GetStarbookHome(ctx context.Context, req *GetStarbookHomeRequest, opts ...client.CallOption) (*GetStarbookHomeResponse, error) {
|
|
resp := new(GetStarbookHomeResponse)
|
|
if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetStarbookHome", opts...); err != nil {
|
|
return nil, err
|
|
}
|
|
return resp, nil
|
|
}
|
|
|
|
func (c *StarbookServiceImpl) GetStarbookItems(ctx context.Context, req *GetStarbookItemsRequest, opts ...client.CallOption) (*GetStarbookItemsResponse, error) {
|
|
resp := new(GetStarbookItemsResponse)
|
|
if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetStarbookItems", opts...); err != nil {
|
|
return nil, err
|
|
}
|
|
return resp, nil
|
|
}
|
|
|
|
var StarbookService_ClientInfo = client.ClientInfo{
|
|
InterfaceName: "topfans.starbook.StarbookService",
|
|
MethodNames: []string{"GetStarbookHome", "GetStarbookItems"},
|
|
ConnectionInjectFunc: func(dubboCliRaw interface{}, conn *client.Connection) {
|
|
dubboCli := dubboCliRaw.(*StarbookServiceImpl)
|
|
dubboCli.conn = conn
|
|
},
|
|
}
|
|
|
|
// StarbookServiceHandler is an implementation of the topfans.starbook.StarbookService service.
|
|
type StarbookServiceHandler interface {
|
|
GetStarbookHome(context.Context, *GetStarbookHomeRequest) (*GetStarbookHomeResponse, error)
|
|
GetStarbookItems(context.Context, *GetStarbookItemsRequest) (*GetStarbookItemsResponse, error)
|
|
}
|
|
|
|
func RegisterStarbookServiceHandler(srv *server.Server, hdlr StarbookServiceHandler, opts ...server.ServiceOption) error {
|
|
return srv.Register(hdlr, &StarbookService_ServiceInfo, opts...)
|
|
}
|
|
|
|
func SetProviderStarbookService(srv common.RPCService) {
|
|
dubbo.SetProviderServiceWithInfo(srv, &StarbookService_ServiceInfo)
|
|
}
|
|
|
|
var StarbookService_ServiceInfo = server.ServiceInfo{
|
|
InterfaceName: "topfans.starbook.StarbookService",
|
|
ServiceType: (*StarbookServiceHandler)(nil),
|
|
Methods: []server.MethodInfo{
|
|
{
|
|
Name: "GetStarbookHome",
|
|
Type: constant.CallUnary,
|
|
ReqInitFunc: func() interface{} {
|
|
return new(GetStarbookHomeRequest)
|
|
},
|
|
MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) {
|
|
req := args[0].(*GetStarbookHomeRequest)
|
|
res, err := handler.(StarbookServiceHandler).GetStarbookHome(ctx, req)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return triple_protocol.NewResponse(res), nil
|
|
},
|
|
},
|
|
{
|
|
Name: "GetStarbookItems",
|
|
Type: constant.CallUnary,
|
|
ReqInitFunc: func() interface{} {
|
|
return new(GetStarbookItemsRequest)
|
|
},
|
|
MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) {
|
|
req := args[0].(*GetStarbookItemsRequest)
|
|
res, err := handler.(StarbookServiceHandler).GetStarbookItems(ctx, req)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return triple_protocol.NewResponse(res), nil
|
|
},
|
|
},
|
|
},
|
|
}
|