app-cloudep-tweeting-service/internal/server/postservice/post_service_server.go

48 lines
1.4 KiB
Go

// Code generated by goctl. DO NOT EDIT.
// Source: tweeting.proto
package server
import (
"context"
"app-cloudep-tweeting-service/gen_result/pb/tweeting"
"app-cloudep-tweeting-service/internal/logic/postservice"
"app-cloudep-tweeting-service/internal/svc"
)
type PostServiceServer struct {
svcCtx *svc.ServiceContext
tweeting.UnimplementedPostServiceServer
}
func NewPostServiceServer(svcCtx *svc.ServiceContext) *PostServiceServer {
return &PostServiceServer{
svcCtx: svcCtx,
}
}
// CreatePost 新增貼文
func (s *PostServiceServer) CreatePost(ctx context.Context, in *tweeting.NewPostReq) (*tweeting.PostResp, error) {
l := postservicelogic.NewCreatePostLogic(ctx, s.svcCtx)
return l.CreatePost(in)
}
// DeletePost 刪除貼文
func (s *PostServiceServer) DeletePost(ctx context.Context, in *tweeting.DeletePostsReq) (*tweeting.OKResp, error) {
l := postservicelogic.NewDeletePostLogic(ctx, s.svcCtx)
return l.DeletePost(in)
}
// UpdatePost 更新貼文
func (s *PostServiceServer) UpdatePost(ctx context.Context, in *tweeting.UpdatePostReq) (*tweeting.OKResp, error) {
l := postservicelogic.NewUpdatePostLogic(ctx, s.svcCtx)
return l.UpdatePost(in)
}
// ListPosts 查詢貼文
func (s *PostServiceServer) ListPosts(ctx context.Context, in *tweeting.QueryPostsReq) (*tweeting.ListPostsResp, error) {
l := postservicelogic.NewListPostsLogic(ctx, s.svcCtx)
return l.ListPosts(in)
}