// Code generated by protoc-gen-triple. DO NOT EDIT. // // Source: proto/ranking.proto package ranking 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 ( // RankingServiceName is the fully-qualified name of the RankingService service. RankingServiceName = "topfans.ranking.RankingService" ) // 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 ( // RankingServiceGetHotRankingProcedure is the fully-qualified name of the RankingService's GetHotRanking RPC. RankingServiceGetHotRankingProcedure = "/topfans.ranking.RankingService/GetHotRanking" // RankingServiceGetOriginalRankingProcedure is the fully-qualified name of the RankingService's GetOriginalRanking RPC. RankingServiceGetOriginalRankingProcedure = "/topfans.ranking.RankingService/GetOriginalRanking" ) var ( _ RankingService = (*RankingServiceImpl)(nil) ) // RankingService is a client for the topfans.ranking.RankingService service. type RankingService interface { GetHotRanking(ctx context.Context, req *GetRankingRequest, opts ...client.CallOption) (*GetRankingResponse, error) GetOriginalRanking(ctx context.Context, req *GetRankingRequest, opts ...client.CallOption) (*GetRankingResponse, error) } // NewRankingService constructs a client for the ranking.RankingService service. func NewRankingService(cli *client.Client, opts ...client.ReferenceOption) (RankingService, error) { conn, err := cli.DialWithInfo("topfans.ranking.RankingService", &RankingService_ClientInfo, opts...) if err != nil { return nil, err } return &RankingServiceImpl{ conn: conn, }, nil } func SetConsumerRankingService(srv common.RPCService) { dubbo.SetConsumerServiceWithInfo(srv, &RankingService_ClientInfo) } // RankingServiceImpl implements RankingService. type RankingServiceImpl struct { conn *client.Connection } func (c *RankingServiceImpl) GetHotRanking(ctx context.Context, req *GetRankingRequest, opts ...client.CallOption) (*GetRankingResponse, error) { resp := new(GetRankingResponse) if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetHotRanking", opts...); err != nil { return nil, err } return resp, nil } func (c *RankingServiceImpl) GetOriginalRanking(ctx context.Context, req *GetRankingRequest, opts ...client.CallOption) (*GetRankingResponse, error) { resp := new(GetRankingResponse) if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetOriginalRanking", opts...); err != nil { return nil, err } return resp, nil } var RankingService_ClientInfo = client.ClientInfo{ InterfaceName: "topfans.ranking.RankingService", MethodNames: []string{"GetHotRanking", "GetOriginalRanking"}, ConnectionInjectFunc: func(dubboCliRaw interface{}, conn *client.Connection) { dubboCli := dubboCliRaw.(*RankingServiceImpl) dubboCli.conn = conn }, } // RankingServiceHandler is an implementation of the topfans.ranking.RankingService service. type RankingServiceHandler interface { GetHotRanking(context.Context, *GetRankingRequest) (*GetRankingResponse, error) GetOriginalRanking(context.Context, *GetRankingRequest) (*GetRankingResponse, error) } func RegisterRankingServiceHandler(srv *server.Server, hdlr RankingServiceHandler, opts ...server.ServiceOption) error { return srv.Register(hdlr, &RankingService_ServiceInfo, opts...) } func SetProviderRankingService(srv common.RPCService) { dubbo.SetProviderServiceWithInfo(srv, &RankingService_ServiceInfo) } var RankingService_ServiceInfo = server.ServiceInfo{ InterfaceName: "topfans.ranking.RankingService", ServiceType: (*RankingServiceHandler)(nil), Methods: []server.MethodInfo{ { Name: "GetHotRanking", Type: constant.CallUnary, ReqInitFunc: func() interface{} { return new(GetRankingRequest) }, MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { req := args[0].(*GetRankingRequest) res, err := handler.(RankingServiceHandler).GetHotRanking(ctx, req) if err != nil { return nil, err } return triple_protocol.NewResponse(res), nil }, }, { Name: "GetOriginalRanking", Type: constant.CallUnary, ReqInitFunc: func() interface{} { return new(GetRankingRequest) }, MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { req := args[0].(*GetRankingRequest) res, err := handler.(RankingServiceHandler).GetOriginalRanking(ctx, req) if err != nil { return nil, err } return triple_protocol.NewResponse(res), nil }, }, }, }