compatibility/task/shop/detail/api/detail_api_triple.pb.go (150 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: detail_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
// DetailClient is the client API for Detail 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 DetailClient interface {
GetItem(ctx context.Context, in *GetItemReq, opts ...grpc_go.CallOption) (*Item, common.ErrorWithAttachment)
DeductStock(ctx context.Context, in *DeductStockReq, opts ...grpc_go.CallOption) (*DeductStockResp, common.ErrorWithAttachment)
}
type detailClient struct {
cc *triple.TripleConn
}
type DetailClientImpl struct {
GetItem func(ctx context.Context, in *GetItemReq) (*Item, error)
DeductStock func(ctx context.Context, in *DeductStockReq) (*DeductStockResp, error)
}
func (c *DetailClientImpl) GetDubboStub(cc *triple.TripleConn) DetailClient {
return NewDetailClient(cc)
}
func (c *DetailClientImpl) XXX_InterfaceName() string {
return "org.apache.dubbogo.samples.shop.detail.api.Detail"
}
func NewDetailClient(cc *triple.TripleConn) DetailClient {
return &detailClient{cc}
}
func (c *detailClient) GetItem(ctx context.Context, in *GetItemReq, opts ...grpc_go.CallOption) (*Item, common.ErrorWithAttachment) {
out := new(Item)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetItem", in, out)
}
func (c *detailClient) DeductStock(ctx context.Context, in *DeductStockReq, opts ...grpc_go.CallOption) (*DeductStockResp, common.ErrorWithAttachment) {
out := new(DeductStockResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/DeductStock", in, out)
}
// DetailServer is the server API for Detail service.
// All implementations must embed UnimplementedDetailServer
// for forward compatibility
type DetailServer interface {
GetItem(context.Context, *GetItemReq) (*Item, error)
DeductStock(context.Context, *DeductStockReq) (*DeductStockResp, error)
mustEmbedUnimplementedDetailServer()
}
// UnimplementedDetailServer must be embedded to have forward compatible implementations.
type UnimplementedDetailServer struct {
proxyImpl protocol.Invoker
}
func (UnimplementedDetailServer) GetItem(context.Context, *GetItemReq) (*Item, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetItem not implemented")
}
func (UnimplementedDetailServer) DeductStock(context.Context, *DeductStockReq) (*DeductStockResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeductStock not implemented")
}
func (s *UnimplementedDetailServer) XXX_SetProxyImpl(impl protocol.Invoker) {
s.proxyImpl = impl
}
func (s *UnimplementedDetailServer) XXX_GetProxyImpl() protocol.Invoker {
return s.proxyImpl
}
func (s *UnimplementedDetailServer) XXX_ServiceDesc() *grpc_go.ServiceDesc {
return &Detail_ServiceDesc
}
func (s *UnimplementedDetailServer) XXX_InterfaceName() string {
return "org.apache.dubbogo.samples.shop.detail.api.Detail"
}
func (UnimplementedDetailServer) mustEmbedUnimplementedDetailServer() {}
// UnsafeDetailServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to DetailServer will
// result in compilation errors.
type UnsafeDetailServer interface {
mustEmbedUnimplementedDetailServer()
}
func RegisterDetailServer(s grpc_go.ServiceRegistrar, srv DetailServer) {
s.RegisterService(&Detail_ServiceDesc, srv)
}
func _Detail_GetItem_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetItemReq)
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("GetItem", 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 _Detail_DeductStock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(DeductStockReq)
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("DeductStock", 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)
}
// Detail_ServiceDesc is the grpc_go.ServiceDesc for Detail service.
// It's only intended for direct use with grpc_go.RegisterService,
// and not to be introspected or modified (even as a copy)
var Detail_ServiceDesc = grpc_go.ServiceDesc{
ServiceName: "org.apache.dubbogo.samples.shop.detail.api.Detail",
HandlerType: (*DetailServer)(nil),
Methods: []grpc_go.MethodDesc{
{
MethodName: "GetItem",
Handler: _Detail_GetItem_Handler,
},
{
MethodName: "DeductStock",
Handler: _Detail_DeductStock_Handler,
},
},
Streams: []grpc_go.StreamDesc{},
Metadata: "detail_api.proto",
}