java_interop/non-protobuf-dubbo/proto/greet.dubbo.go (78 lines of code) (raw):

// Code generated by protoc-gen-go-dubbo. DO NOT EDIT. // Source: greet.proto // Package: org_apache_dubbo_hessian2_api package greet import ( "context" "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/server" ) const ( // GreetingsServiceName is the fully-qualified name of the GreetingsService service. GreetingsServiceName = "org.apache.dubbo.hessian2.api.GreetingsService" // 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. // GreetingsServiceGreetProcedure is the fully-qualified name of the GreetingsService's Greet RPC.' GreetingsServiceGreetProcedure = "/org.apache.dubbo.hessian2.api.GreetingsService/greet" ) var ( _ GreetingsService = (*GreetingsServiceImpl)(nil) ) type GreetingsService interface { Greet(ctx context.Context, req *GreetRequest, opts ...client.CallOption) (*GreetResponse, error) } // NewGreetingsService constructs a client for the org.apache.dubbo.hessian2.api.GreetingsService service func NewGreetingsService(cli *client.Client, opts ...client.ReferenceOption) (GreetingsService, error) { conn, err := cli.DialWithInfo("org.apache.dubbo.hessian2.api.GreetingsService", &GreetingsService_ClientInfo, opts...) if err != nil { return nil, err } return &GreetingsServiceImpl{ conn: conn, }, nil } func SetConsumerService(srv common.RPCService) { dubbo.SetConsumerServiceWithInfo(srv, &GreetingsService_ClientInfo) } // GreetingsServiceImpl implements GreetingsService type GreetingsServiceImpl struct { conn *client.Connection } func (c *GreetingsServiceImpl) Greet(ctx context.Context, req *GreetRequest, opts ...client.CallOption) (*GreetResponse, error) { resp := new(GreetResponse) if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "greet", opts...); err != nil { return nil, err } return resp, nil } var GreetingsService_ClientInfo = client.ClientInfo{ InterfaceName: "org.apache.dubbo.hessian2.api.GreetingsService", MethodNames: []string{ "greet", }, ConnectionInjectFunc: func(dubboCliRaw interface{}, conn *client.Connection) { dubboCli := dubboCliRaw.(*GreetingsServiceImpl) dubboCli.conn = conn }, } // GreetingsServiceHandler is an implementation of the org.apache.dubbo.hessian2.api.GreetingsService service. type GreetingsServiceHandler interface { Greet(ctx context.Context, req *GreetRequest) (*GreetResponse, error) } func RegisterGreetingsServiceHandler(srv *server.Server, hdlr GreetingsServiceHandler, opts ...server.ServiceOption) error { return srv.Register(hdlr, &GreetingsService_ServiceInfo, opts...) } func SetProviderService(srv common.RPCService) { dubbo.SetProviderServiceWithInfo(srv, &GreetingsService_ServiceInfo) } var GreetingsService_ServiceInfo = server.ServiceInfo{ InterfaceName: "org.apache.dubbo.hessian2.api.GreetingsService", ServiceType: (*GreetingsServiceHandler)(nil), Methods: []server.MethodInfo{ { Name: "greet", Type: constant.CallUnary, ReqInitFunc: func() interface{} { return new(GreetResponse) }, MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { req := args[0].(*GreetRequest) res, err := handler.(GreetingsServiceHandler).Greet(ctx, req) return res, err }, }, }, }