commentrpc

package
v0.0.0-...-b1757e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 8 Imported by: 0

README

compile

protoc -I=. --go_out=. --go_opt=module="github.com/IanZC0der/go-myblog" --go-grpc_out=. --go-grpc_opt=module="github.com/IanZC0der/go-myblog" apps/comment/proto/comment.proto

to be updated for this section

Documentation

Index

Constants

View Source
const (
	CommentService_AddComment_FullMethodName             = "/commentrpc.CommentService/AddComment"
	CommentService_GetAllCommentsByBlogId_FullMethodName = "/commentrpc.CommentService/GetAllCommentsByBlogId"
)

Variables

View Source
var CommentService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "commentrpc.CommentService",
	HandlerType: (*CommentServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "AddComment",
			Handler:    _CommentService_AddComment_Handler,
		},
		{
			MethodName: "GetAllCommentsByBlogId",
			Handler:    _CommentService_GetAllCommentsByBlogId_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "apps/commentrpc/proto/comment.proto",
}

CommentService_ServiceDesc is the grpc.ServiceDesc for CommentService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_apps_commentrpc_proto_comment_proto protoreflect.FileDescriptor

Functions

func RegisterCommentServiceServer

func RegisterCommentServiceServer(s grpc.ServiceRegistrar, srv CommentServiceServer)

Types

type AddCommentRequest

type AddCommentRequest struct {

	// @gotags: json:"message"
	Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message"`
	// @gotags: json:"user_name"
	UserName string `protobuf:"bytes,2,opt,name=user_name,json=userName,proto3" json:"user_name"`
	// @gotags: json:"blog_id"
	BlogId int64 `protobuf:"varint,3,opt,name=blog_id,json=blogId,proto3" json:"blog_id"`
	// contains filtered or unexported fields
}

func (*AddCommentRequest) Descriptor deprecated

func (*AddCommentRequest) Descriptor() ([]byte, []int)

Deprecated: Use AddCommentRequest.ProtoReflect.Descriptor instead.

func (*AddCommentRequest) GetBlogId

func (x *AddCommentRequest) GetBlogId() int64

func (*AddCommentRequest) GetMessage

func (x *AddCommentRequest) GetMessage() string

func (*AddCommentRequest) GetUserName

func (x *AddCommentRequest) GetUserName() string

func (*AddCommentRequest) ProtoMessage

func (*AddCommentRequest) ProtoMessage()

func (*AddCommentRequest) ProtoReflect

func (x *AddCommentRequest) ProtoReflect() protoreflect.Message

func (*AddCommentRequest) Reset

func (x *AddCommentRequest) Reset()

func (*AddCommentRequest) String

func (x *AddCommentRequest) String() string

type Comment

type Comment struct {

	// string message = 1;
	// @gotags: json:"created_at"
	CreatedAt int64 `protobuf:"varint,1,opt,name=created_at,json=createdAt,proto3" json:"created_at"`
	// string commentor = 3;
	// int64 blog_id = 4;
	CommentRequest *AddCommentRequest `protobuf:"bytes,2,opt,name=comment_request,json=commentRequest,proto3" json:"comment_request,omitempty"`
	// contains filtered or unexported fields
}

func (*Comment) Descriptor deprecated

func (*Comment) Descriptor() ([]byte, []int)

Deprecated: Use Comment.ProtoReflect.Descriptor instead.

func (*Comment) GetCommentRequest

func (x *Comment) GetCommentRequest() *AddCommentRequest

func (*Comment) GetCreatedAt

func (x *Comment) GetCreatedAt() int64

func (*Comment) ProtoMessage

func (*Comment) ProtoMessage()

func (*Comment) ProtoReflect

func (x *Comment) ProtoReflect() protoreflect.Message

func (*Comment) Reset

func (x *Comment) Reset()

func (*Comment) String

func (x *Comment) String() string

type CommentList

type CommentList struct {

	// @gotags: json:"comments"
	Comments []*Comment `protobuf:"bytes,1,rep,name=comments,proto3" json:"comments"`
	// @gotags: json:"total"
	Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total"`
	// contains filtered or unexported fields
}

func (*CommentList) Descriptor deprecated

func (*CommentList) Descriptor() ([]byte, []int)

Deprecated: Use CommentList.ProtoReflect.Descriptor instead.

func (*CommentList) GetComments

func (x *CommentList) GetComments() []*Comment

func (*CommentList) GetTotal

func (x *CommentList) GetTotal() int64

func (*CommentList) ProtoMessage

func (*CommentList) ProtoMessage()

func (*CommentList) ProtoReflect

func (x *CommentList) ProtoReflect() protoreflect.Message

func (*CommentList) Reset

func (x *CommentList) Reset()

func (*CommentList) String

func (x *CommentList) String() string

type CommentServiceClient

type CommentServiceClient interface {
	// add a comment
	AddComment(ctx context.Context, in *AddCommentRequest, opts ...grpc.CallOption) (*Comment, error)
	// get comments for a blog by blog id
	GetAllCommentsByBlogId(ctx context.Context, in *GetCommentRequest, opts ...grpc.CallOption) (*CommentList, error)
}

CommentServiceClient is the client API for CommentService 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 CommentServiceServer

type CommentServiceServer interface {
	// add a comment
	AddComment(context.Context, *AddCommentRequest) (*Comment, error)
	// get comments for a blog by blog id
	GetAllCommentsByBlogId(context.Context, *GetCommentRequest) (*CommentList, error)
	// contains filtered or unexported methods
}

CommentServiceServer is the server API for CommentService service. All implementations must embed UnimplementedCommentServiceServer for forward compatibility

type GetCommentRequest

type GetCommentRequest struct {

	// @gotags: json:"blog_id"
	BlogId int64 `protobuf:"varint,1,opt,name=blog_id,json=blogId,proto3" json:"blog_id"`
	// contains filtered or unexported fields
}

func (*GetCommentRequest) Descriptor deprecated

func (*GetCommentRequest) Descriptor() ([]byte, []int)

Deprecated: Use GetCommentRequest.ProtoReflect.Descriptor instead.

func (*GetCommentRequest) GetBlogId

func (x *GetCommentRequest) GetBlogId() int64

func (*GetCommentRequest) ProtoMessage

func (*GetCommentRequest) ProtoMessage()

func (*GetCommentRequest) ProtoReflect

func (x *GetCommentRequest) ProtoReflect() protoreflect.Message

func (*GetCommentRequest) Reset

func (x *GetCommentRequest) Reset()

func (*GetCommentRequest) String

func (x *GetCommentRequest) String() string

type UnimplementedCommentServiceServer

type UnimplementedCommentServiceServer struct {
}

UnimplementedCommentServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedCommentServiceServer) AddComment

func (UnimplementedCommentServiceServer) GetAllCommentsByBlogId

type UnsafeCommentServiceServer

type UnsafeCommentServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeCommentServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to CommentServiceServer will result in compilation errors.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL