244 lines
9.1 KiB
Go
244 lines
9.1 KiB
Go
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
// versions:
|
|
// - protoc-gen-go-grpc v1.6.0
|
|
// - protoc v6.33.1
|
|
// source: post.proto
|
|
|
|
package gen
|
|
|
|
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 (
|
|
PostService_GetPost_FullMethodName = "/proto.PostService/GetPost"
|
|
PostService_GetPostBatch_FullMethodName = "/proto.PostService/GetPostBatch"
|
|
PostService_SearchPosts_FullMethodName = "/proto.PostService/SearchPosts"
|
|
PostService_ListPosts_FullMethodName = "/proto.PostService/ListPosts"
|
|
)
|
|
|
|
// PostServiceClient is the client API for PostService 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 PostServiceClient interface {
|
|
// Get a single post by id
|
|
GetPost(ctx context.Context, in *GetPostRequest, opts ...grpc.CallOption) (*Post, error)
|
|
// Get multiple posts by ids
|
|
GetPostBatch(ctx context.Context, in *GetPostBatchRequest, opts ...grpc.CallOption) (*GetPostBatchResponse, error)
|
|
// Search posts
|
|
SearchPosts(ctx context.Context, in *SearchPostsRequest, opts ...grpc.CallOption) (*SearchPostsResponse, error)
|
|
// List posts with filters
|
|
ListPosts(ctx context.Context, in *ListPostsRequest, opts ...grpc.CallOption) (*ListPostsResponse, error)
|
|
}
|
|
|
|
type postServiceClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewPostServiceClient(cc grpc.ClientConnInterface) PostServiceClient {
|
|
return &postServiceClient{cc}
|
|
}
|
|
|
|
func (c *postServiceClient) GetPost(ctx context.Context, in *GetPostRequest, opts ...grpc.CallOption) (*Post, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(Post)
|
|
err := c.cc.Invoke(ctx, PostService_GetPost_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *postServiceClient) GetPostBatch(ctx context.Context, in *GetPostBatchRequest, opts ...grpc.CallOption) (*GetPostBatchResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(GetPostBatchResponse)
|
|
err := c.cc.Invoke(ctx, PostService_GetPostBatch_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *postServiceClient) SearchPosts(ctx context.Context, in *SearchPostsRequest, opts ...grpc.CallOption) (*SearchPostsResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(SearchPostsResponse)
|
|
err := c.cc.Invoke(ctx, PostService_SearchPosts_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *postServiceClient) ListPosts(ctx context.Context, in *ListPostsRequest, opts ...grpc.CallOption) (*ListPostsResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(ListPostsResponse)
|
|
err := c.cc.Invoke(ctx, PostService_ListPosts_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// PostServiceServer is the server API for PostService service.
|
|
// All implementations must embed UnimplementedPostServiceServer
|
|
// for forward compatibility.
|
|
type PostServiceServer interface {
|
|
// Get a single post by id
|
|
GetPost(context.Context, *GetPostRequest) (*Post, error)
|
|
// Get multiple posts by ids
|
|
GetPostBatch(context.Context, *GetPostBatchRequest) (*GetPostBatchResponse, error)
|
|
// Search posts
|
|
SearchPosts(context.Context, *SearchPostsRequest) (*SearchPostsResponse, error)
|
|
// List posts with filters
|
|
ListPosts(context.Context, *ListPostsRequest) (*ListPostsResponse, error)
|
|
mustEmbedUnimplementedPostServiceServer()
|
|
}
|
|
|
|
// UnimplementedPostServiceServer 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 UnimplementedPostServiceServer struct{}
|
|
|
|
func (UnimplementedPostServiceServer) GetPost(context.Context, *GetPostRequest) (*Post, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method GetPost not implemented")
|
|
}
|
|
func (UnimplementedPostServiceServer) GetPostBatch(context.Context, *GetPostBatchRequest) (*GetPostBatchResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method GetPostBatch not implemented")
|
|
}
|
|
func (UnimplementedPostServiceServer) SearchPosts(context.Context, *SearchPostsRequest) (*SearchPostsResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method SearchPosts not implemented")
|
|
}
|
|
func (UnimplementedPostServiceServer) ListPosts(context.Context, *ListPostsRequest) (*ListPostsResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method ListPosts not implemented")
|
|
}
|
|
func (UnimplementedPostServiceServer) mustEmbedUnimplementedPostServiceServer() {}
|
|
func (UnimplementedPostServiceServer) testEmbeddedByValue() {}
|
|
|
|
// UnsafePostServiceServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to PostServiceServer will
|
|
// result in compilation errors.
|
|
type UnsafePostServiceServer interface {
|
|
mustEmbedUnimplementedPostServiceServer()
|
|
}
|
|
|
|
func RegisterPostServiceServer(s grpc.ServiceRegistrar, srv PostServiceServer) {
|
|
// If the following call panics, it indicates UnimplementedPostServiceServer 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(&PostService_ServiceDesc, srv)
|
|
}
|
|
|
|
func _PostService_GetPost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(GetPostRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(PostServiceServer).GetPost(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: PostService_GetPost_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(PostServiceServer).GetPost(ctx, req.(*GetPostRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _PostService_GetPostBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(GetPostBatchRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(PostServiceServer).GetPostBatch(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: PostService_GetPostBatch_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(PostServiceServer).GetPostBatch(ctx, req.(*GetPostBatchRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _PostService_SearchPosts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(SearchPostsRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(PostServiceServer).SearchPosts(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: PostService_SearchPosts_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(PostServiceServer).SearchPosts(ctx, req.(*SearchPostsRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _PostService_ListPosts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(ListPostsRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(PostServiceServer).ListPosts(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: PostService_ListPosts_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(PostServiceServer).ListPosts(ctx, req.(*ListPostsRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
// PostService_ServiceDesc is the grpc.ServiceDesc for PostService service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var PostService_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "proto.PostService",
|
|
HandlerType: (*PostServiceServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "GetPost",
|
|
Handler: _PostService_GetPost_Handler,
|
|
},
|
|
{
|
|
MethodName: "GetPostBatch",
|
|
Handler: _PostService_GetPostBatch_Handler,
|
|
},
|
|
{
|
|
MethodName: "SearchPosts",
|
|
Handler: _PostService_SearchPosts_Handler,
|
|
},
|
|
{
|
|
MethodName: "ListPosts",
|
|
Handler: _PostService_ListPosts_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{},
|
|
Metadata: "post.proto",
|
|
}
|