client/golang/feed/post_grpc.pb.go

408 lines
14 KiB
Go

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc (unknown)
// source: post.proto
package feed
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Post_Fetch_FullMethodName = "/feed.Post/Fetch"
Post_Create_FullMethodName = "/feed.Post/Create"
Post_Change_FullMethodName = "/feed.Post/Change"
Post_Remove_FullMethodName = "/feed.Post/Remove"
Post_CommentList_FullMethodName = "/feed.Post/CommentList"
Post_AddComment_FullMethodName = "/feed.Post/AddComment"
Post_DeleteComment_FullMethodName = "/feed.Post/DeleteComment"
Post_Action_FullMethodName = "/feed.Post/Action"
)
// PostClient is the client API for Post 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 PostClient interface {
// 推文列表
Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*PostListReply, error)
// 新建推文
Create(ctx context.Context, in *PostItem, opts ...grpc.CallOption) (*StatusReply, error)
// 修改推文
Change(ctx context.Context, in *PostItem, opts ...grpc.CallOption) (*StatusReply, error)
// 删除推文
Remove(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
// 评论列表
CommentList(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*CommentListReply, error)
// 新建评论
AddComment(ctx context.Context, in *CommentItem, opts ...grpc.CallOption) (*StatusReply, error)
// 删除评论
DeleteComment(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
// 计数操作
Action(ctx context.Context, in *PostActionRequest, opts ...grpc.CallOption) (*StatusReply, error)
}
type postClient struct {
cc grpc.ClientConnInterface
}
func NewPostClient(cc grpc.ClientConnInterface) PostClient {
return &postClient{cc}
}
func (c *postClient) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*PostListReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PostListReply)
err := c.cc.Invoke(ctx, Post_Fetch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *postClient) Create(ctx context.Context, in *PostItem, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Post_Create_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *postClient) Change(ctx context.Context, in *PostItem, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Post_Change_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *postClient) Remove(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Post_Remove_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *postClient) CommentList(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*CommentListReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CommentListReply)
err := c.cc.Invoke(ctx, Post_CommentList_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *postClient) AddComment(ctx context.Context, in *CommentItem, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Post_AddComment_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *postClient) DeleteComment(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Post_DeleteComment_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *postClient) Action(ctx context.Context, in *PostActionRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Post_Action_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// PostServer is the server API for Post service.
// All implementations must embed UnimplementedPostServer
// for forward compatibility.
//
// 推文相关操作
type PostServer interface {
// 推文列表
Fetch(context.Context, *FetchRequest) (*PostListReply, error)
// 新建推文
Create(context.Context, *PostItem) (*StatusReply, error)
// 修改推文
Change(context.Context, *PostItem) (*StatusReply, error)
// 删除推文
Remove(context.Context, *IdentRequest) (*StatusReply, error)
// 评论列表
CommentList(context.Context, *FetchRequest) (*CommentListReply, error)
// 新建评论
AddComment(context.Context, *CommentItem) (*StatusReply, error)
// 删除评论
DeleteComment(context.Context, *IdentRequest) (*StatusReply, error)
// 计数操作
Action(context.Context, *PostActionRequest) (*StatusReply, error)
mustEmbedUnimplementedPostServer()
}
// UnimplementedPostServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedPostServer struct{}
func (UnimplementedPostServer) Fetch(context.Context, *FetchRequest) (*PostListReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Fetch not implemented")
}
func (UnimplementedPostServer) Create(context.Context, *PostItem) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
}
func (UnimplementedPostServer) Change(context.Context, *PostItem) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Change not implemented")
}
func (UnimplementedPostServer) Remove(context.Context, *IdentRequest) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Remove not implemented")
}
func (UnimplementedPostServer) CommentList(context.Context, *FetchRequest) (*CommentListReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method CommentList not implemented")
}
func (UnimplementedPostServer) AddComment(context.Context, *CommentItem) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddComment not implemented")
}
func (UnimplementedPostServer) DeleteComment(context.Context, *IdentRequest) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteComment not implemented")
}
func (UnimplementedPostServer) Action(context.Context, *PostActionRequest) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Action not implemented")
}
func (UnimplementedPostServer) mustEmbedUnimplementedPostServer() {}
func (UnimplementedPostServer) testEmbeddedByValue() {}
// UnsafePostServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PostServer will
// result in compilation errors.
type UnsafePostServer interface {
mustEmbedUnimplementedPostServer()
}
func RegisterPostServer(s grpc.ServiceRegistrar, srv PostServer) {
// If the following call pancis, it indicates UnimplementedPostServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Post_ServiceDesc, srv)
}
func _Post_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(FetchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PostServer).Fetch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Post_Fetch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServer).Fetch(ctx, req.(*FetchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Post_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PostItem)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PostServer).Create(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Post_Create_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServer).Create(ctx, req.(*PostItem))
}
return interceptor(ctx, in, info, handler)
}
func _Post_Change_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PostItem)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PostServer).Change(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Post_Change_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServer).Change(ctx, req.(*PostItem))
}
return interceptor(ctx, in, info, handler)
}
func _Post_Remove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IdentRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PostServer).Remove(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Post_Remove_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServer).Remove(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Post_CommentList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(FetchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PostServer).CommentList(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Post_CommentList_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServer).CommentList(ctx, req.(*FetchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Post_AddComment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CommentItem)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PostServer).AddComment(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Post_AddComment_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServer).AddComment(ctx, req.(*CommentItem))
}
return interceptor(ctx, in, info, handler)
}
func _Post_DeleteComment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IdentRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PostServer).DeleteComment(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Post_DeleteComment_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServer).DeleteComment(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Post_Action_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PostActionRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PostServer).Action(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Post_Action_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServer).Action(ctx, req.(*PostActionRequest))
}
return interceptor(ctx, in, info, handler)
}
// Post_ServiceDesc is the grpc.ServiceDesc for Post service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Post_ServiceDesc = grpc.ServiceDesc{
ServiceName: "feed.Post",
HandlerType: (*PostServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Fetch",
Handler: _Post_Fetch_Handler,
},
{
MethodName: "Create",
Handler: _Post_Create_Handler,
},
{
MethodName: "Change",
Handler: _Post_Change_Handler,
},
{
MethodName: "Remove",
Handler: _Post_Remove_Handler,
},
{
MethodName: "CommentList",
Handler: _Post_CommentList_Handler,
},
{
MethodName: "AddComment",
Handler: _Post_AddComment_Handler,
},
{
MethodName: "DeleteComment",
Handler: _Post_DeleteComment_Handler,
},
{
MethodName: "Action",
Handler: _Post_Action_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "post.proto",
}