compatibility/task/shop/comment/api/comment_api_triple.pb.go (107 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: comment_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
// CommentClient is the client API for Comment 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 CommentClient interface {
GetComment(ctx context.Context, in *CommentReq, opts ...grpc_go.CallOption) (*CommentResp, common.ErrorWithAttachment)
}
type commentClient struct {
cc *triple.TripleConn
}
type CommentClientImpl struct {
GetComment func(ctx context.Context, in *CommentReq) (*CommentResp, error)
}
func (c *CommentClientImpl) GetDubboStub(cc *triple.TripleConn) CommentClient {
return NewCommentClient(cc)
}
func (c *CommentClientImpl) XXX_InterfaceName() string {
return "org.apache.dubbogo.samples.shop.comment.api.Comment"
}
func NewCommentClient(cc *triple.TripleConn) CommentClient {
return &commentClient{cc}
}
func (c *commentClient) GetComment(ctx context.Context, in *CommentReq, opts ...grpc_go.CallOption) (*CommentResp, common.ErrorWithAttachment) {
out := new(CommentResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetComment", in, out)
}
// CommentServer is the server API for Comment service.
// All implementations must embed UnimplementedCommentServer
// for forward compatibility
type CommentServer interface {
GetComment(context.Context, *CommentReq) (*CommentResp, error)
mustEmbedUnimplementedCommentServer()
}
// UnimplementedCommentServer must be embedded to have forward compatible implementations.
type UnimplementedCommentServer struct {
proxyImpl protocol.Invoker
}
func (UnimplementedCommentServer) GetComment(context.Context, *CommentReq) (*CommentResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetComment not implemented")
}
func (s *UnimplementedCommentServer) XXX_SetProxyImpl(impl protocol.Invoker) {
s.proxyImpl = impl
}
func (s *UnimplementedCommentServer) XXX_GetProxyImpl() protocol.Invoker {
return s.proxyImpl
}
func (s *UnimplementedCommentServer) XXX_ServiceDesc() *grpc_go.ServiceDesc {
return &Comment_ServiceDesc
}
func (s *UnimplementedCommentServer) XXX_InterfaceName() string {
return "org.apache.dubbogo.samples.shop.comment.api.Comment"
}
func (UnimplementedCommentServer) mustEmbedUnimplementedCommentServer() {}
// UnsafeCommentServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to CommentServer will
// result in compilation errors.
type UnsafeCommentServer interface {
mustEmbedUnimplementedCommentServer()
}
func RegisterCommentServer(s grpc_go.ServiceRegistrar, srv CommentServer) {
s.RegisterService(&Comment_ServiceDesc, srv)
}
func _Comment_GetComment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(CommentReq)
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("GetComment", 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)
}
// Comment_ServiceDesc is the grpc_go.ServiceDesc for Comment service.
// It's only intended for direct use with grpc_go.RegisterService,
// and not to be introspected or modified (even as a copy)
var Comment_ServiceDesc = grpc_go.ServiceDesc{
ServiceName: "org.apache.dubbogo.samples.shop.comment.api.Comment",
HandlerType: (*CommentServer)(nil),
Methods: []grpc_go.MethodDesc{
{
MethodName: "GetComment",
Handler: _Comment_GetComment_Handler,
},
},
Streams: []grpc_go.StreamDesc{},
Metadata: "comment_api.proto",
}