compatibility/task/shop/user/api/user_api_triple.pb.go (236 lines of code) (raw):
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions:
// - protoc-gen-go-triple v1.0.8
// - protoc v3.21.12
// source: user_api.proto
package api
import (
context "context"
protocol "dubbo.apache.org/dubbo-go/v3/protocol"
dubbo3 "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3"
invocation "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
grpc_go "github.com/dubbogo/grpc-go"
codes "github.com/dubbogo/grpc-go/codes"
metadata "github.com/dubbogo/grpc-go/metadata"
status "github.com/dubbogo/grpc-go/status"
common "github.com/dubbogo/triple/pkg/common"
constant "github.com/dubbogo/triple/pkg/common/constant"
triple "github.com/dubbogo/triple/pkg/triple"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc_go.SupportPackageIsVersion7
// UserServiceClient is the client API for UserService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type UserServiceClient interface {
Register(ctx context.Context, in *User, opts ...grpc_go.CallOption) (*RegisterResp, common.ErrorWithAttachment)
Login(ctx context.Context, in *LoginReq, opts ...grpc_go.CallOption) (*User, common.ErrorWithAttachment)
TimeoutLogin(ctx context.Context, in *LoginReq, opts ...grpc_go.CallOption) (*User, common.ErrorWithAttachment)
GetInfo(ctx context.Context, in *GetInfoReq, opts ...grpc_go.CallOption) (*User, common.ErrorWithAttachment)
}
type userServiceClient struct {
cc *triple.TripleConn
}
type UserServiceClientImpl struct {
Register func(ctx context.Context, in *User) (*RegisterResp, error)
Login func(ctx context.Context, in *LoginReq) (*User, error)
TimeoutLogin func(ctx context.Context, in *LoginReq) (*User, error)
GetInfo func(ctx context.Context, in *GetInfoReq) (*User, error)
}
func (c *UserServiceClientImpl) GetDubboStub(cc *triple.TripleConn) UserServiceClient {
return NewUserServiceClient(cc)
}
func (c *UserServiceClientImpl) XXX_InterfaceName() string {
return "org.apache.dubbogo.samples.shop.user.api.UserService"
}
func NewUserServiceClient(cc *triple.TripleConn) UserServiceClient {
return &userServiceClient{cc}
}
func (c *userServiceClient) Register(ctx context.Context, in *User, opts ...grpc_go.CallOption) (*RegisterResp, common.ErrorWithAttachment) {
out := new(RegisterResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Register", in, out)
}
func (c *userServiceClient) Login(ctx context.Context, in *LoginReq, opts ...grpc_go.CallOption) (*User, common.ErrorWithAttachment) {
out := new(User)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Login", in, out)
}
func (c *userServiceClient) TimeoutLogin(ctx context.Context, in *LoginReq, opts ...grpc_go.CallOption) (*User, common.ErrorWithAttachment) {
out := new(User)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/TimeoutLogin", in, out)
}
func (c *userServiceClient) GetInfo(ctx context.Context, in *GetInfoReq, opts ...grpc_go.CallOption) (*User, common.ErrorWithAttachment) {
out := new(User)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetInfo", in, out)
}
// UserServiceServer is the server API for UserService service.
// All implementations must embed UnimplementedUserServiceServer
// for forward compatibility
type UserServiceServer interface {
Register(context.Context, *User) (*RegisterResp, error)
Login(context.Context, *LoginReq) (*User, error)
TimeoutLogin(context.Context, *LoginReq) (*User, error)
GetInfo(context.Context, *GetInfoReq) (*User, error)
mustEmbedUnimplementedUserServiceServer()
}
// UnimplementedUserServiceServer must be embedded to have forward compatible implementations.
type UnimplementedUserServiceServer struct {
proxyImpl protocol.Invoker
}
func (UnimplementedUserServiceServer) Register(context.Context, *User) (*RegisterResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Register not implemented")
}
func (UnimplementedUserServiceServer) Login(context.Context, *LoginReq) (*User, error) {
return nil, status.Errorf(codes.Unimplemented, "method Login not implemented")
}
func (UnimplementedUserServiceServer) TimeoutLogin(context.Context, *LoginReq) (*User, error) {
return nil, status.Errorf(codes.Unimplemented, "method TimeoutLogin not implemented")
}
func (UnimplementedUserServiceServer) GetInfo(context.Context, *GetInfoReq) (*User, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetInfo not implemented")
}
func (s *UnimplementedUserServiceServer) XXX_SetProxyImpl(impl protocol.Invoker) {
s.proxyImpl = impl
}
func (s *UnimplementedUserServiceServer) XXX_GetProxyImpl() protocol.Invoker {
return s.proxyImpl
}
func (s *UnimplementedUserServiceServer) XXX_ServiceDesc() *grpc_go.ServiceDesc {
return &UserService_ServiceDesc
}
func (s *UnimplementedUserServiceServer) XXX_InterfaceName() string {
return "org.apache.dubbogo.samples.shop.user.api.UserService"
}
func (UnimplementedUserServiceServer) mustEmbedUnimplementedUserServiceServer() {}
// UnsafeUserServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to UserServiceServer will
// result in compilation errors.
type UnsafeUserServiceServer interface {
mustEmbedUnimplementedUserServiceServer()
}
func RegisterUserServiceServer(s grpc_go.ServiceRegistrar, srv UserServiceServer) {
s.RegisterService(&UserService_ServiceDesc, srv)
}
func _UserService_Register_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(User)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("Register", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _UserService_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(LoginReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("Login", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _UserService_TimeoutLogin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(LoginReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("TimeoutLogin", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _UserService_GetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetInfoReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("GetInfo", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
// UserService_ServiceDesc is the grpc_go.ServiceDesc for UserService service.
// It's only intended for direct use with grpc_go.RegisterService,
// and not to be introspected or modified (even as a copy)
var UserService_ServiceDesc = grpc_go.ServiceDesc{
ServiceName: "org.apache.dubbogo.samples.shop.user.api.UserService",
HandlerType: (*UserServiceServer)(nil),
Methods: []grpc_go.MethodDesc{
{
MethodName: "Register",
Handler: _UserService_Register_Handler,
},
{
MethodName: "Login",
Handler: _UserService_Login_Handler,
},
{
MethodName: "TimeoutLogin",
Handler: _UserService_TimeoutLogin_Handler,
},
{
MethodName: "GetInfo",
Handler: _UserService_GetInfo_Handler,
},
},
Streams: []grpc_go.StreamDesc{},
Metadata: "user_api.proto",
}