dev
This commit is contained in:
33
server/category_server.go
Normal file
33
server/category_server.go
Normal file
@@ -0,0 +1,33 @@
|
||||
// Code generated by protoc-gen-slc. DO NOT EDIT.
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"protoc-gen-slc/internal/logic/category"
|
||||
pb "protoc-gen-slc/pb"
|
||||
)
|
||||
|
||||
type CategoryServer struct {
|
||||
pb.UnimplementedCategoryServer
|
||||
}
|
||||
|
||||
func NewCategoryServer() *CategoryServer {
|
||||
return &CategoryServer{}
|
||||
}
|
||||
|
||||
// 分类列表
|
||||
func (s *CategoryServer) CategoryList(ctx context.Context, in *pb.Empty) (*pb.CategoryListReply, error) {
|
||||
return category.CategoryList(ctx, in)
|
||||
}
|
||||
|
||||
func (s *CategoryServer) AddCategory(ctx context.Context, in *pb.AddCategoryRequest) (*pb.AddCategoryResponse, error) {
|
||||
return category.AddCategory(ctx, in)
|
||||
}
|
||||
|
||||
func (s *CategoryServer) ModifyCategory(ctx context.Context, in *pb.ModifyCategoryRequest) (*pb.Empty, error) {
|
||||
return category.ModifyCategory(ctx, in)
|
||||
}
|
||||
|
||||
func (s *CategoryServer) DeleteCategory(ctx context.Context, in *pb.DeleteCategoryRequest) (*pb.Empty, error) {
|
||||
return category.DeleteCategory(ctx, in)
|
||||
}
|
||||
21
server/new.go
Normal file
21
server/new.go
Normal file
@@ -0,0 +1,21 @@
|
||||
// Code generated by protoc-gen-slc. DO NOT EDIT.
|
||||
package server
|
||||
|
||||
import (
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/reflection"
|
||||
pb "protoc-gen-slc/pb"
|
||||
)
|
||||
|
||||
func New() *grpc.Server {
|
||||
srv := grpc.NewServer()
|
||||
|
||||
// register service to grpc.Server
|
||||
pb.RegisterCategoryServer(srv, NewCategoryServer())
|
||||
pb.RegisterPostServer(srv, NewPostServer())
|
||||
pb.RegisterTagsServer(srv, NewTagsServer())
|
||||
|
||||
reflection.Register(srv)
|
||||
|
||||
return srv
|
||||
}
|
||||
97
server/post_server.go
Normal file
97
server/post_server.go
Normal file
@@ -0,0 +1,97 @@
|
||||
// Code generated by protoc-gen-slc. DO NOT EDIT.
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"protoc-gen-slc/internal/logic/post"
|
||||
pb "protoc-gen-slc/pb"
|
||||
)
|
||||
|
||||
type PostServer struct {
|
||||
pb.UnimplementedPostServer
|
||||
}
|
||||
|
||||
func NewPostServer() *PostServer {
|
||||
return &PostServer{}
|
||||
}
|
||||
|
||||
// 文章列表
|
||||
func (s *PostServer) PostList(ctx context.Context, in *pb.PostListRequest) (*pb.PostListReply, error) {
|
||||
return post.PostList(ctx, in)
|
||||
}
|
||||
|
||||
// 获取文章详情
|
||||
func (s *PostServer) GetPost(ctx context.Context, in *pb.GetPostRequest) (*pb.PostItem, error) {
|
||||
return post.GetPost(ctx, in)
|
||||
}
|
||||
|
||||
// 发布文章
|
||||
func (s *PostServer) AddPost(ctx context.Context, in *pb.PostItem) (*pb.StatusReply, error) {
|
||||
return post.AddPost(ctx, in)
|
||||
}
|
||||
|
||||
// 修改文章
|
||||
func (s *PostServer) ModifyPost(ctx context.Context, in *pb.PostItem) (*pb.StatusReply, error) {
|
||||
return post.ModifyPost(ctx, in)
|
||||
}
|
||||
|
||||
// 删除文章
|
||||
func (s *PostServer) DeletePost(ctx context.Context, in *pb.IdentRequest) (*pb.StatusReply, error) {
|
||||
return post.DeletePost(ctx, in)
|
||||
}
|
||||
|
||||
// 文章点赞处理
|
||||
func (s *PostServer) IncrPostLike(ctx context.Context, in *pb.PostOpIdentityRequest) (*pb.StatusReply, error) {
|
||||
return post.IncrPostLike(ctx, in)
|
||||
}
|
||||
|
||||
func (s *PostServer) DescPostLike(ctx context.Context, in *pb.PostOpIdentityRequest) (*pb.StatusReply, error) {
|
||||
return post.DescPostLike(ctx, in)
|
||||
}
|
||||
|
||||
// 文章点踩处理
|
||||
func (s *PostServer) IncrPostUnlike(ctx context.Context, in *pb.PostOpIdentityRequest) (*pb.StatusReply, error) {
|
||||
return post.IncrPostUnlike(ctx, in)
|
||||
}
|
||||
|
||||
func (s *PostServer) DescPostUnlike(ctx context.Context, in *pb.PostOpIdentityRequest) (*pb.StatusReply, error) {
|
||||
return post.DescPostUnlike(ctx, in)
|
||||
}
|
||||
|
||||
// 评论列表
|
||||
func (s *PostServer) CommentList(ctx context.Context, in *pb.CommentListRequest) (*pb.CommentListResponse, error) {
|
||||
return post.CommentList(ctx, in)
|
||||
}
|
||||
|
||||
// 发布评论
|
||||
func (s *PostServer) AddComment(ctx context.Context, in *pb.CommentItem) (*pb.StatusReply, error) {
|
||||
return post.AddComment(ctx, in)
|
||||
}
|
||||
|
||||
// 修改评论
|
||||
func (s *PostServer) ModifyComment(ctx context.Context, in *pb.CommentItem) (*pb.StatusReply, error) {
|
||||
return post.ModifyComment(ctx, in)
|
||||
}
|
||||
|
||||
// 删除评论
|
||||
func (s *PostServer) DeleteComment(ctx context.Context, in *pb.DeleteCommentRequest) (*pb.StatusReply, error) {
|
||||
return post.DeleteComment(ctx, in)
|
||||
}
|
||||
|
||||
// 评论点赞处理
|
||||
func (s *PostServer) IncrCommentLike(ctx context.Context, in *pb.CommentOpIdentityRequest) (*pb.StatusReply, error) {
|
||||
return post.IncrCommentLike(ctx, in)
|
||||
}
|
||||
|
||||
func (s *PostServer) DescCommentLike(ctx context.Context, in *pb.CommentOpIdentityRequest) (*pb.StatusReply, error) {
|
||||
return post.DescCommentLike(ctx, in)
|
||||
}
|
||||
|
||||
// 评论点踩处理
|
||||
func (s *PostServer) IncrCommentUnlike(ctx context.Context, in *pb.CommentOpIdentityRequest) (*pb.StatusReply, error) {
|
||||
return post.IncrCommentUnlike(ctx, in)
|
||||
}
|
||||
|
||||
func (s *PostServer) DescCommentUnlike(ctx context.Context, in *pb.CommentOpIdentityRequest) (*pb.StatusReply, error) {
|
||||
return post.DescCommentUnlike(ctx, in)
|
||||
}
|
||||
36
server/tags_server.go
Normal file
36
server/tags_server.go
Normal file
@@ -0,0 +1,36 @@
|
||||
// Code generated by protoc-gen-slc. DO NOT EDIT.
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"protoc-gen-slc/internal/logic/tags"
|
||||
pb "protoc-gen-slc/pb"
|
||||
)
|
||||
|
||||
type TagsServer struct {
|
||||
pb.UnimplementedTagsServer
|
||||
}
|
||||
|
||||
func NewTagsServer() *TagsServer {
|
||||
return &TagsServer{}
|
||||
}
|
||||
|
||||
// 标签列表
|
||||
func (s *TagsServer) TagsList(ctx context.Context, in *pb.IdentRequest) (*pb.TagsListReply, error) {
|
||||
return tags.TagsList(ctx, in)
|
||||
}
|
||||
|
||||
// 创建标签
|
||||
func (s *TagsServer) AddTags(ctx context.Context, in *pb.TagsItem) (*pb.StatusReply, error) {
|
||||
return tags.AddTags(ctx, in)
|
||||
}
|
||||
|
||||
// 修改标签
|
||||
func (s *TagsServer) ModifyTags(ctx context.Context, in *pb.TagsItem) (*pb.StatusReply, error) {
|
||||
return tags.ModifyTags(ctx, in)
|
||||
}
|
||||
|
||||
// 删除标签
|
||||
func (s *TagsServer) DeleteTags(ctx context.Context, in *pb.IdentRequest) (*pb.StatusReply, error) {
|
||||
return tags.DeleteTags(ctx, in)
|
||||
}
|
||||
Reference in New Issue
Block a user