I am batman

This commit is contained in:
2026-06-20 11:07:01 -04:00
commit 013d01358c
52 changed files with 7615 additions and 0 deletions

687
proto/post/post.pb.go Normal file
View File

@@ -0,0 +1,687 @@
// -----------------------------------------------------------------------------
// File: post.proto
//
// This Protocol Buffers file defines the gRPC contract for the PostService.
// It includes service definitions for creating, retrieving, updating, deleting,
// and listing posts. Each RPC method has corresponding request and response
// messages. The syntax follows proto3 conventions and uses message types for
// structured data exchange between microservices.
//
// Syntax:
// - Uses proto3 syntax for modern Protocol Buffers features.
// - Defines service and message types for CRUD operations.
// - Supports repeated fields for listing multiple posts.
//
// Purpose:
// - Enables strongly-typed, language-agnostic communication between services.
// - Provides a contract for backend and API Gateway integration.
// - Facilitates code generation for gRPC servers and clients.
// -----------------------------------------------------------------------------
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.7
// protoc v6.31.1
// source: post.proto
package postpb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
emptypb "google.golang.org/protobuf/types/known/emptypb"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type Post struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
AuthorId string `protobuf:"bytes,2,opt,name=author_id,json=authorId,proto3" json:"author_id,omitempty"`
Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"`
CreatedAt int64 `protobuf:"varint,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
UpdatedAt int64 `protobuf:"varint,6,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Post) Reset() {
*x = Post{}
mi := &file_post_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Post) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Post) ProtoMessage() {}
func (x *Post) ProtoReflect() protoreflect.Message {
mi := &file_post_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Post.ProtoReflect.Descriptor instead.
func (*Post) Descriptor() ([]byte, []int) {
return file_post_proto_rawDescGZIP(), []int{0}
}
func (x *Post) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *Post) GetAuthorId() string {
if x != nil {
return x.AuthorId
}
return ""
}
func (x *Post) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *Post) GetContent() string {
if x != nil {
return x.Content
}
return ""
}
func (x *Post) GetCreatedAt() int64 {
if x != nil {
return x.CreatedAt
}
return 0
}
func (x *Post) GetUpdatedAt() int64 {
if x != nil {
return x.UpdatedAt
}
return 0
}
type CreatePostRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
AuthorId string `protobuf:"bytes,1,opt,name=author_id,json=authorId,proto3" json:"author_id,omitempty"`
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
Content string `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CreatePostRequest) Reset() {
*x = CreatePostRequest{}
mi := &file_post_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CreatePostRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreatePostRequest) ProtoMessage() {}
func (x *CreatePostRequest) ProtoReflect() protoreflect.Message {
mi := &file_post_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CreatePostRequest.ProtoReflect.Descriptor instead.
func (*CreatePostRequest) Descriptor() ([]byte, []int) {
return file_post_proto_rawDescGZIP(), []int{1}
}
func (x *CreatePostRequest) GetAuthorId() string {
if x != nil {
return x.AuthorId
}
return ""
}
func (x *CreatePostRequest) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *CreatePostRequest) GetContent() string {
if x != nil {
return x.Content
}
return ""
}
type CreatePostResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Post *Post `protobuf:"bytes,1,opt,name=post,proto3" json:"post,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CreatePostResponse) Reset() {
*x = CreatePostResponse{}
mi := &file_post_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CreatePostResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreatePostResponse) ProtoMessage() {}
func (x *CreatePostResponse) ProtoReflect() protoreflect.Message {
mi := &file_post_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CreatePostResponse.ProtoReflect.Descriptor instead.
func (*CreatePostResponse) Descriptor() ([]byte, []int) {
return file_post_proto_rawDescGZIP(), []int{2}
}
func (x *CreatePostResponse) GetPost() *Post {
if x != nil {
return x.Post
}
return nil
}
type GetPostRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetPostRequest) Reset() {
*x = GetPostRequest{}
mi := &file_post_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetPostRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetPostRequest) ProtoMessage() {}
func (x *GetPostRequest) ProtoReflect() protoreflect.Message {
mi := &file_post_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetPostRequest.ProtoReflect.Descriptor instead.
func (*GetPostRequest) Descriptor() ([]byte, []int) {
return file_post_proto_rawDescGZIP(), []int{3}
}
func (x *GetPostRequest) GetId() string {
if x != nil {
return x.Id
}
return ""
}
type GetPostResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Post *Post `protobuf:"bytes,1,opt,name=post,proto3" json:"post,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetPostResponse) Reset() {
*x = GetPostResponse{}
mi := &file_post_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetPostResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetPostResponse) ProtoMessage() {}
func (x *GetPostResponse) ProtoReflect() protoreflect.Message {
mi := &file_post_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetPostResponse.ProtoReflect.Descriptor instead.
func (*GetPostResponse) Descriptor() ([]byte, []int) {
return file_post_proto_rawDescGZIP(), []int{4}
}
func (x *GetPostResponse) GetPost() *Post {
if x != nil {
return x.Post
}
return nil
}
type UpdatePostRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
Content string `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *UpdatePostRequest) Reset() {
*x = UpdatePostRequest{}
mi := &file_post_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *UpdatePostRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdatePostRequest) ProtoMessage() {}
func (x *UpdatePostRequest) ProtoReflect() protoreflect.Message {
mi := &file_post_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UpdatePostRequest.ProtoReflect.Descriptor instead.
func (*UpdatePostRequest) Descriptor() ([]byte, []int) {
return file_post_proto_rawDescGZIP(), []int{5}
}
func (x *UpdatePostRequest) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *UpdatePostRequest) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *UpdatePostRequest) GetContent() string {
if x != nil {
return x.Content
}
return ""
}
type UpdatePostResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Post *Post `protobuf:"bytes,1,opt,name=post,proto3" json:"post,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *UpdatePostResponse) Reset() {
*x = UpdatePostResponse{}
mi := &file_post_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *UpdatePostResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdatePostResponse) ProtoMessage() {}
func (x *UpdatePostResponse) ProtoReflect() protoreflect.Message {
mi := &file_post_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UpdatePostResponse.ProtoReflect.Descriptor instead.
func (*UpdatePostResponse) Descriptor() ([]byte, []int) {
return file_post_proto_rawDescGZIP(), []int{6}
}
func (x *UpdatePostResponse) GetPost() *Post {
if x != nil {
return x.Post
}
return nil
}
type DeletePostRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *DeletePostRequest) Reset() {
*x = DeletePostRequest{}
mi := &file_post_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *DeletePostRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeletePostRequest) ProtoMessage() {}
func (x *DeletePostRequest) ProtoReflect() protoreflect.Message {
mi := &file_post_proto_msgTypes[7]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DeletePostRequest.ProtoReflect.Descriptor instead.
func (*DeletePostRequest) Descriptor() ([]byte, []int) {
return file_post_proto_rawDescGZIP(), []int{7}
}
func (x *DeletePostRequest) GetId() string {
if x != nil {
return x.Id
}
return ""
}
type ListPostsRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ListPostsRequest) Reset() {
*x = ListPostsRequest{}
mi := &file_post_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListPostsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListPostsRequest) ProtoMessage() {}
func (x *ListPostsRequest) ProtoReflect() protoreflect.Message {
mi := &file_post_proto_msgTypes[8]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListPostsRequest.ProtoReflect.Descriptor instead.
func (*ListPostsRequest) Descriptor() ([]byte, []int) {
return file_post_proto_rawDescGZIP(), []int{8}
}
func (x *ListPostsRequest) GetPage() int32 {
if x != nil {
return x.Page
}
return 0
}
func (x *ListPostsRequest) GetPageSize() int32 {
if x != nil {
return x.PageSize
}
return 0
}
type ListPostsResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Posts []*Post `protobuf:"bytes,1,rep,name=posts,proto3" json:"posts,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ListPostsResponse) Reset() {
*x = ListPostsResponse{}
mi := &file_post_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListPostsResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListPostsResponse) ProtoMessage() {}
func (x *ListPostsResponse) ProtoReflect() protoreflect.Message {
mi := &file_post_proto_msgTypes[9]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListPostsResponse.ProtoReflect.Descriptor instead.
func (*ListPostsResponse) Descriptor() ([]byte, []int) {
return file_post_proto_rawDescGZIP(), []int{9}
}
func (x *ListPostsResponse) GetPosts() []*Post {
if x != nil {
return x.Posts
}
return nil
}
var File_post_proto protoreflect.FileDescriptor
const file_post_proto_rawDesc = "" +
"\n" +
"\n" +
"post.proto\x12\x04post\x1a\x1bgoogle/protobuf/empty.proto\"\xa1\x01\n" +
"\x04Post\x12\x0e\n" +
"\x02id\x18\x01 \x01(\tR\x02id\x12\x1b\n" +
"\tauthor_id\x18\x02 \x01(\tR\bauthorId\x12\x14\n" +
"\x05title\x18\x03 \x01(\tR\x05title\x12\x18\n" +
"\acontent\x18\x04 \x01(\tR\acontent\x12\x1d\n" +
"\n" +
"created_at\x18\x05 \x01(\x03R\tcreatedAt\x12\x1d\n" +
"\n" +
"updated_at\x18\x06 \x01(\x03R\tupdatedAt\"`\n" +
"\x11CreatePostRequest\x12\x1b\n" +
"\tauthor_id\x18\x01 \x01(\tR\bauthorId\x12\x14\n" +
"\x05title\x18\x02 \x01(\tR\x05title\x12\x18\n" +
"\acontent\x18\x03 \x01(\tR\acontent\"4\n" +
"\x12CreatePostResponse\x12\x1e\n" +
"\x04post\x18\x01 \x01(\v2\n" +
".post.PostR\x04post\" \n" +
"\x0eGetPostRequest\x12\x0e\n" +
"\x02id\x18\x01 \x01(\tR\x02id\"1\n" +
"\x0fGetPostResponse\x12\x1e\n" +
"\x04post\x18\x01 \x01(\v2\n" +
".post.PostR\x04post\"S\n" +
"\x11UpdatePostRequest\x12\x0e\n" +
"\x02id\x18\x01 \x01(\tR\x02id\x12\x14\n" +
"\x05title\x18\x02 \x01(\tR\x05title\x12\x18\n" +
"\acontent\x18\x03 \x01(\tR\acontent\"4\n" +
"\x12UpdatePostResponse\x12\x1e\n" +
"\x04post\x18\x01 \x01(\v2\n" +
".post.PostR\x04post\"#\n" +
"\x11DeletePostRequest\x12\x0e\n" +
"\x02id\x18\x01 \x01(\tR\x02id\"C\n" +
"\x10ListPostsRequest\x12\x12\n" +
"\x04page\x18\x01 \x01(\x05R\x04page\x12\x1b\n" +
"\tpage_size\x18\x02 \x01(\x05R\bpageSize\"5\n" +
"\x11ListPostsResponse\x12 \n" +
"\x05posts\x18\x01 \x03(\v2\n" +
".post.PostR\x05posts2\xc4\x02\n" +
"\vPostService\x12?\n" +
"\n" +
"CreatePost\x12\x17.post.CreatePostRequest\x1a\x18.post.CreatePostResponse\x126\n" +
"\aGetPost\x12\x14.post.GetPostRequest\x1a\x15.post.GetPostResponse\x12?\n" +
"\n" +
"UpdatePost\x12\x17.post.UpdatePostRequest\x1a\x18.post.UpdatePostResponse\x12=\n" +
"\n" +
"DeletePost\x12\x17.post.DeletePostRequest\x1a\x16.google.protobuf.Empty\x12<\n" +
"\tListPosts\x12\x16.post.ListPostsRequest\x1a\x17.post.ListPostsResponseB\x0eZ\f/post;postpbb\x06proto3"
var (
file_post_proto_rawDescOnce sync.Once
file_post_proto_rawDescData []byte
)
func file_post_proto_rawDescGZIP() []byte {
file_post_proto_rawDescOnce.Do(func() {
file_post_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_post_proto_rawDesc), len(file_post_proto_rawDesc)))
})
return file_post_proto_rawDescData
}
var file_post_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_post_proto_goTypes = []any{
(*Post)(nil), // 0: post.Post
(*CreatePostRequest)(nil), // 1: post.CreatePostRequest
(*CreatePostResponse)(nil), // 2: post.CreatePostResponse
(*GetPostRequest)(nil), // 3: post.GetPostRequest
(*GetPostResponse)(nil), // 4: post.GetPostResponse
(*UpdatePostRequest)(nil), // 5: post.UpdatePostRequest
(*UpdatePostResponse)(nil), // 6: post.UpdatePostResponse
(*DeletePostRequest)(nil), // 7: post.DeletePostRequest
(*ListPostsRequest)(nil), // 8: post.ListPostsRequest
(*ListPostsResponse)(nil), // 9: post.ListPostsResponse
(*emptypb.Empty)(nil), // 10: google.protobuf.Empty
}
var file_post_proto_depIdxs = []int32{
0, // 0: post.CreatePostResponse.post:type_name -> post.Post
0, // 1: post.GetPostResponse.post:type_name -> post.Post
0, // 2: post.UpdatePostResponse.post:type_name -> post.Post
0, // 3: post.ListPostsResponse.posts:type_name -> post.Post
1, // 4: post.PostService.CreatePost:input_type -> post.CreatePostRequest
3, // 5: post.PostService.GetPost:input_type -> post.GetPostRequest
5, // 6: post.PostService.UpdatePost:input_type -> post.UpdatePostRequest
7, // 7: post.PostService.DeletePost:input_type -> post.DeletePostRequest
8, // 8: post.PostService.ListPosts:input_type -> post.ListPostsRequest
2, // 9: post.PostService.CreatePost:output_type -> post.CreatePostResponse
4, // 10: post.PostService.GetPost:output_type -> post.GetPostResponse
6, // 11: post.PostService.UpdatePost:output_type -> post.UpdatePostResponse
10, // 12: post.PostService.DeletePost:output_type -> google.protobuf.Empty
9, // 13: post.PostService.ListPosts:output_type -> post.ListPostsResponse
9, // [9:14] is the sub-list for method output_type
4, // [4:9] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_post_proto_init() }
func file_post_proto_init() {
if File_post_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_post_proto_rawDesc), len(file_post_proto_rawDesc)),
NumEnums: 0,
NumMessages: 10,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_post_proto_goTypes,
DependencyIndexes: file_post_proto_depIdxs,
MessageInfos: file_post_proto_msgTypes,
}.Build()
File_post_proto = out.File
file_post_proto_goTypes = nil
file_post_proto_depIdxs = nil
}

294
proto/post/post_grpc.pb.go Normal file
View File

@@ -0,0 +1,294 @@
// -----------------------------------------------------------------------------
// File: post.proto
//
// This Protocol Buffers file defines the gRPC contract for the PostService.
// It includes service definitions for creating, retrieving, updating, deleting,
// and listing posts. Each RPC method has corresponding request and response
// messages. The syntax follows proto3 conventions and uses message types for
// structured data exchange between microservices.
//
// Syntax:
// - Uses proto3 syntax for modern Protocol Buffers features.
// - Defines service and message types for CRUD operations.
// - Supports repeated fields for listing multiple posts.
//
// Purpose:
// - Enables strongly-typed, language-agnostic communication between services.
// - Provides a contract for backend and API Gateway integration.
// - Facilitates code generation for gRPC servers and clients.
// -----------------------------------------------------------------------------
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v6.31.1
// source: post.proto
package postpb
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
// 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_CreatePost_FullMethodName = "/post.PostService/CreatePost"
PostService_GetPost_FullMethodName = "/post.PostService/GetPost"
PostService_UpdatePost_FullMethodName = "/post.PostService/UpdatePost"
PostService_DeletePost_FullMethodName = "/post.PostService/DeletePost"
PostService_ListPosts_FullMethodName = "/post.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 {
CreatePost(ctx context.Context, in *CreatePostRequest, opts ...grpc.CallOption) (*CreatePostResponse, error)
GetPost(ctx context.Context, in *GetPostRequest, opts ...grpc.CallOption) (*GetPostResponse, error)
UpdatePost(ctx context.Context, in *UpdatePostRequest, opts ...grpc.CallOption) (*UpdatePostResponse, error)
DeletePost(ctx context.Context, in *DeletePostRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
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) CreatePost(ctx context.Context, in *CreatePostRequest, opts ...grpc.CallOption) (*CreatePostResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CreatePostResponse)
err := c.cc.Invoke(ctx, PostService_CreatePost_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *postServiceClient) GetPost(ctx context.Context, in *GetPostRequest, opts ...grpc.CallOption) (*GetPostResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetPostResponse)
err := c.cc.Invoke(ctx, PostService_GetPost_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *postServiceClient) UpdatePost(ctx context.Context, in *UpdatePostRequest, opts ...grpc.CallOption) (*UpdatePostResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UpdatePostResponse)
err := c.cc.Invoke(ctx, PostService_UpdatePost_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *postServiceClient) DeletePost(ctx context.Context, in *DeletePostRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, PostService_DeletePost_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 {
CreatePost(context.Context, *CreatePostRequest) (*CreatePostResponse, error)
GetPost(context.Context, *GetPostRequest) (*GetPostResponse, error)
UpdatePost(context.Context, *UpdatePostRequest) (*UpdatePostResponse, error)
DeletePost(context.Context, *DeletePostRequest) (*emptypb.Empty, error)
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) CreatePost(context.Context, *CreatePostRequest) (*CreatePostResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreatePost not implemented")
}
func (UnimplementedPostServiceServer) GetPost(context.Context, *GetPostRequest) (*GetPostResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetPost not implemented")
}
func (UnimplementedPostServiceServer) UpdatePost(context.Context, *UpdatePostRequest) (*UpdatePostResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdatePost not implemented")
}
func (UnimplementedPostServiceServer) DeletePost(context.Context, *DeletePostRequest) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeletePost not implemented")
}
func (UnimplementedPostServiceServer) ListPosts(context.Context, *ListPostsRequest) (*ListPostsResponse, error) {
return nil, status.Errorf(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 pancis, 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_CreatePost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreatePostRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PostServiceServer).CreatePost(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PostService_CreatePost_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).CreatePost(ctx, req.(*CreatePostRequest))
}
return interceptor(ctx, in, info, handler)
}
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_UpdatePost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdatePostRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PostServiceServer).UpdatePost(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PostService_UpdatePost_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).UpdatePost(ctx, req.(*UpdatePostRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PostService_DeletePost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeletePostRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PostServiceServer).DeletePost(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: PostService_DeletePost_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).DeletePost(ctx, req.(*DeletePostRequest))
}
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: "post.PostService",
HandlerType: (*PostServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "CreatePost",
Handler: _PostService_CreatePost_Handler,
},
{
MethodName: "GetPost",
Handler: _PostService_GetPost_Handler,
},
{
MethodName: "UpdatePost",
Handler: _PostService_UpdatePost_Handler,
},
{
MethodName: "DeletePost",
Handler: _PostService_DeletePost_Handler,
},
{
MethodName: "ListPosts",
Handler: _PostService_ListPosts_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "post.proto",
}