comment

package
v0.0.0-...-ad531c1 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const (
	AppName = "comment"
)

Variables

View Source
var File_apps_comment_pb_comment_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "dousheng.interaction.comment.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CommentAction",
			Handler:    _Service_CommentAction_Handler,
		},
		{
			MethodName: "GetCommentList",
			Handler:    _Service_GetCommentList_Handler,
		},
		{
			MethodName: "GetCommentCountById",
			Handler:    _Service_GetCommentCountById_Handler,
		},
		{
			MethodName: "CommentCountMap",
			Handler:    _Service_CommentCountMap_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "apps/comment/pb/comment.proto",
}

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

Functions

func RegisterServiceServer

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

Types

type Comment

type Comment struct {

	// 评论id
	Id      int64      `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	User    *user.User `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"`
	Content string     `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"`
	// 评论日期 格式 mm-dd
	CreateDate string `protobuf:"bytes,4,opt,name=create_date,json=createDate,proto3" json:"create_date,omitempty"`
	// contains filtered or unexported fields
}

评论实体

func (*Comment) Descriptor deprecated

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

Deprecated: Use Comment.ProtoReflect.Descriptor instead.

func (*Comment) GetContent

func (x *Comment) GetContent() string

func (*Comment) GetCreateDate

func (x *Comment) GetCreateDate() string

func (*Comment) GetId

func (x *Comment) GetId() int64

func (*Comment) GetUser

func (x *Comment) GetUser() *user.User

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 CommentActionRequest

type CommentActionRequest struct {

	// 用户鉴权token
	// @gotags: json:"token" form:"token" binding:"required" validate:"required"
	Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token" form:"token" binding:"required" validate:"required"`
	// 视频id
	// @gotags: json:"video_id" form:"video_id" binding:"required" validate:"required"
	VideoId int64 `` /* 128-byte string literal not displayed */
	// 1-发布评论 2-删除评论
	// @gotags: json:"action_type" form:"action_type" binding:"required" validate:"required"
	ActionType int64 `` /* 140-byte string literal not displayed */
	// 用户填写的评论内容,在action_type=1时候使用,可选选项不需要binding,也不需要参与校验
	// @gotags: json:"comment_text" form:"comment_text"
	CommentText string `protobuf:"bytes,4,opt,name=comment_text,json=commentText,proto3" json:"comment_text" form:"comment_text"`
	// action_type = 2时候使用
	// @gotags: json:"comment_id" form:"comment_id"
	CommentId int64 `protobuf:"varint,5,opt,name=comment_id,json=commentId,proto3" json:"comment_id" form:"comment_id"`
	// contains filtered or unexported fields
}

发表评论请求体

func NewCommentActionRequest

func NewCommentActionRequest() *CommentActionRequest

func (*CommentActionRequest) Descriptor deprecated

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

Deprecated: Use CommentActionRequest.ProtoReflect.Descriptor instead.

func (*CommentActionRequest) GetActionType

func (x *CommentActionRequest) GetActionType() int64

func (*CommentActionRequest) GetCommentId

func (x *CommentActionRequest) GetCommentId() int64

func (*CommentActionRequest) GetCommentText

func (x *CommentActionRequest) GetCommentText() string

func (*CommentActionRequest) GetToken

func (x *CommentActionRequest) GetToken() string

func (*CommentActionRequest) GetVideoId

func (x *CommentActionRequest) GetVideoId() int64

func (*CommentActionRequest) ProtoMessage

func (*CommentActionRequest) ProtoMessage()

func (*CommentActionRequest) ProtoReflect

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

func (*CommentActionRequest) Reset

func (x *CommentActionRequest) Reset()

func (*CommentActionRequest) String

func (x *CommentActionRequest) String() string

func (*CommentActionRequest) Validate

func (c *CommentActionRequest) Validate() error

发布/删除评论 参数校验

type CommentActionResponse

type CommentActionResponse struct {
	Comment *Comment `protobuf:"bytes,3,opt,name=comment,proto3" json:"comment,omitempty"`
	// contains filtered or unexported fields
}

评论操作响应体

func NewDefaultCommentActionResponse

func NewDefaultCommentActionResponse() *CommentActionResponse

创建评论操作响应体

func (*CommentActionResponse) Descriptor deprecated

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

Deprecated: Use CommentActionResponse.ProtoReflect.Descriptor instead.

func (*CommentActionResponse) GetComment

func (x *CommentActionResponse) GetComment() *Comment

func (*CommentActionResponse) ProtoMessage

func (*CommentActionResponse) ProtoMessage()

func (*CommentActionResponse) ProtoReflect

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

func (*CommentActionResponse) Reset

func (x *CommentActionResponse) Reset()

func (*CommentActionResponse) String

func (x *CommentActionResponse) String() string

type CommentMapRequest

type CommentMapRequest struct {

	// 视频ID 列表
	// @gotags: json:"video_ids"
	VideoIds []int64 `protobuf:"varint,1,rep,packed,name=video_ids,json=videoIds,proto3" json:"video_ids"`
	// contains filtered or unexported fields
}

视频评论 IDs

func NewCommentMapRequest

func NewCommentMapRequest() *CommentMapRequest

func (*CommentMapRequest) Descriptor deprecated

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

Deprecated: Use CommentMapRequest.ProtoReflect.Descriptor instead.

func (*CommentMapRequest) GetVideoIds

func (x *CommentMapRequest) GetVideoIds() []int64

func (*CommentMapRequest) ProtoMessage

func (*CommentMapRequest) ProtoMessage()

func (*CommentMapRequest) ProtoReflect

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

func (*CommentMapRequest) Reset

func (x *CommentMapRequest) Reset()

func (*CommentMapRequest) String

func (x *CommentMapRequest) String() string

type CommentMapResponse

type CommentMapResponse struct {

	// 用户列表:map[videoId] = comment_count_map
	// @gotags: json:"comment_count_map"
	CommentCountMap map[int64]int64 `` /* 188-byte string literal not displayed */
	// contains filtered or unexported fields
}

视频评论列表:map[userId] = comment_count_map

func NewCommentMapResponse

func NewCommentMapResponse() *CommentMapResponse

func (*CommentMapResponse) Descriptor deprecated

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

Deprecated: Use CommentMapResponse.ProtoReflect.Descriptor instead.

func (*CommentMapResponse) GetCommentCountMap

func (x *CommentMapResponse) GetCommentCountMap() map[int64]int64

func (*CommentMapResponse) ProtoMessage

func (*CommentMapResponse) ProtoMessage()

func (*CommentMapResponse) ProtoReflect

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

func (*CommentMapResponse) Reset

func (x *CommentMapResponse) Reset()

func (*CommentMapResponse) String

func (x *CommentMapResponse) String() string

type CommentPo

type CommentPo struct {

	// 评论id
	Id      int64  `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	UserId  int64  `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	VideoId int64  `protobuf:"varint,3,opt,name=video_id,json=videoId,proto3" json:"video_id,omitempty"`
	Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"`
	// 评论日期 格式 mm-dd
	CreateDate string `protobuf:"bytes,5,opt,name=create_date,json=createDate,proto3" json:"create_date,omitempty"`
	// contains filtered or unexported fields
}

func NewDefaultCommentPo

func NewDefaultCommentPo() *CommentPo

构建Po

func (*CommentPo) Descriptor deprecated

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

Deprecated: Use CommentPo.ProtoReflect.Descriptor instead.

func (*CommentPo) GetContent

func (x *CommentPo) GetContent() string

func (*CommentPo) GetCreateDate

func (x *CommentPo) GetCreateDate() string

func (*CommentPo) GetId

func (x *CommentPo) GetId() int64

func (*CommentPo) GetUserId

func (x *CommentPo) GetUserId() int64

func (*CommentPo) GetVideoId

func (x *CommentPo) GetVideoId() int64

func (*CommentPo) ProtoMessage

func (*CommentPo) ProtoMessage()

func (*CommentPo) ProtoReflect

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

func (*CommentPo) Reset

func (x *CommentPo) Reset()

func (*CommentPo) String

func (x *CommentPo) String() string

func (*CommentPo) TableName

func (*CommentPo) TableName() string

TableName 指明表名 -> gorm 参数映射

type GetCommentCountByIdRequest

type GetCommentCountByIdRequest struct {

	// 视频ID
	// @gotags: json:"video_id"
	VideoId int64 `protobuf:"varint,1,opt,name=video_id,json=videoId,proto3" json:"video_id"`
	// contains filtered or unexported fields
}

func NewDefaultGetCommentCountByIdRequest

func NewDefaultGetCommentCountByIdRequest() *GetCommentCountByIdRequest

func (*GetCommentCountByIdRequest) Descriptor deprecated

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

Deprecated: Use GetCommentCountByIdRequest.ProtoReflect.Descriptor instead.

func (*GetCommentCountByIdRequest) GetVideoId

func (x *GetCommentCountByIdRequest) GetVideoId() int64

func (*GetCommentCountByIdRequest) ProtoMessage

func (*GetCommentCountByIdRequest) ProtoMessage()

func (*GetCommentCountByIdRequest) ProtoReflect

func (*GetCommentCountByIdRequest) Reset

func (x *GetCommentCountByIdRequest) Reset()

func (*GetCommentCountByIdRequest) String

func (x *GetCommentCountByIdRequest) String() string

func (*GetCommentCountByIdRequest) Validate

func (r *GetCommentCountByIdRequest) Validate() error

获取评论列表 参数校验

type GetCommentCountByIdResponse

type GetCommentCountByIdResponse struct {

	// 评论数量
	// @gotags: json:"comment_count"
	CommentCount int64 `protobuf:"varint,1,opt,name=comment_count,json=commentCount,proto3" json:"comment_count"`
	// contains filtered or unexported fields
}

func NewDefaultGetCommentCountByIdResponse

func NewDefaultGetCommentCountByIdResponse() *GetCommentCountByIdResponse

func (*GetCommentCountByIdResponse) Descriptor deprecated

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

Deprecated: Use GetCommentCountByIdResponse.ProtoReflect.Descriptor instead.

func (*GetCommentCountByIdResponse) GetCommentCount

func (x *GetCommentCountByIdResponse) GetCommentCount() int64

func (*GetCommentCountByIdResponse) ProtoMessage

func (*GetCommentCountByIdResponse) ProtoMessage()

func (*GetCommentCountByIdResponse) ProtoReflect

func (*GetCommentCountByIdResponse) Reset

func (x *GetCommentCountByIdResponse) Reset()

func (*GetCommentCountByIdResponse) String

func (x *GetCommentCountByIdResponse) String() string

type GetCommentListRequest

type GetCommentListRequest struct {

	// @gotags: json:"token" form:"token" validate:"required" binding:"required"
	Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token" form:"token" validate:"required" binding:"required"`
	// @gotags: json:"video_id" form:"video_id" validate:"required" binding:"required"
	VideoId int64 `` /* 128-byte string literal not displayed */
	// contains filtered or unexported fields
}

获取评论列表请求体

func NewDefaultGetCommentListRequest

func NewDefaultGetCommentListRequest() *GetCommentListRequest

func (*GetCommentListRequest) Descriptor deprecated

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

Deprecated: Use GetCommentListRequest.ProtoReflect.Descriptor instead.

func (*GetCommentListRequest) GetToken

func (x *GetCommentListRequest) GetToken() string

func (*GetCommentListRequest) GetVideoId

func (x *GetCommentListRequest) GetVideoId() int64

func (*GetCommentListRequest) ProtoMessage

func (*GetCommentListRequest) ProtoMessage()

func (*GetCommentListRequest) ProtoReflect

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

func (*GetCommentListRequest) Reset

func (x *GetCommentListRequest) Reset()

func (*GetCommentListRequest) String

func (x *GetCommentListRequest) String() string

func (*GetCommentListRequest) Validate

func (r *GetCommentListRequest) Validate() error

获取评论列表 参数校验

type GetCommentListResponse

type GetCommentListResponse struct {
	CommentList []*Comment `protobuf:"bytes,3,rep,name=comment_list,json=commentList,proto3" json:"comment_list,omitempty"`
	// contains filtered or unexported fields
}

获取评论(列表)响应体

func NewDefaultGetCommentListResponse

func NewDefaultGetCommentListResponse() *GetCommentListResponse

func (*GetCommentListResponse) Descriptor deprecated

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

Deprecated: Use GetCommentListResponse.ProtoReflect.Descriptor instead.

func (*GetCommentListResponse) GetCommentList

func (x *GetCommentListResponse) GetCommentList() []*Comment

func (*GetCommentListResponse) ProtoMessage

func (*GetCommentListResponse) ProtoMessage()

func (*GetCommentListResponse) ProtoReflect

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

func (*GetCommentListResponse) Reset

func (x *GetCommentListResponse) Reset()

func (*GetCommentListResponse) String

func (x *GetCommentListResponse) String() string

type ServiceClient

type ServiceClient interface {
	// 发表评论
	CommentAction(ctx context.Context, in *CommentActionRequest, opts ...grpc.CallOption) (*CommentActionResponse, error)
	// 获取评论
	GetCommentList(ctx context.Context, in *GetCommentListRequest, opts ...grpc.CallOption) (*GetCommentListResponse, error)
	// 通过视频Id获取评论总数
	GetCommentCountById(ctx context.Context, in *GetCommentCountByIdRequest, opts ...grpc.CallOption) (*GetCommentCountByIdResponse, error)
	// 获取视频评论数量 map[videoId] = comment_count
	CommentCountMap(ctx context.Context, in *CommentMapRequest, opts ...grpc.CallOption) (*CommentMapResponse, error)
}

ServiceClient is the client API for Service 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.

func NewServiceClient

func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient

type ServiceServer

type ServiceServer interface {
	// 发表评论
	CommentAction(context.Context, *CommentActionRequest) (*CommentActionResponse, error)
	// 获取评论
	GetCommentList(context.Context, *GetCommentListRequest) (*GetCommentListResponse, error)
	// 通过视频Id获取评论总数
	GetCommentCountById(context.Context, *GetCommentCountByIdRequest) (*GetCommentCountByIdResponse, error)
	// 获取视频评论数量 map[videoId] = comment_count
	CommentCountMap(context.Context, *CommentMapRequest) (*CommentMapResponse, error)
	// contains filtered or unexported methods
}

ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) CommentAction

func (UnimplementedServiceServer) CommentCountMap

func (UnimplementedServiceServer) GetCommentList

type UnsafeServiceServer

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

UnsafeServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ServiceServer 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