favorite

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: 3

Documentation

Index

Constants

View Source
const (
	AppName = "favorite"
)

Variables

View Source
var File_apps_favorite_pb_favorite_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "dousheng.interaction.favorite.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "FavoriteAction",
			Handler:    _Service_FavoriteAction_Handler,
		},
		{
			MethodName: "FavoriteList",
			Handler:    _Service_FavoriteList_Handler,
		},
		{
			MethodName: "FavoriteCount",
			Handler:    _Service_FavoriteCount_Handler,
		},
		{
			MethodName: "FavoriteCountMap",
			Handler:    _Service_FavoriteCountMap_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "apps/favorite/pb/favorite.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 FavoriteActionRequest

type FavoriteActionRequest struct {

	// 用户鉴权Token
	// @gotags: json:"token" form:"token" binding:"required"
	Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token" form:"token" binding:"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 */
	// contains filtered or unexported fields
}

定义 点赞/取消点赞 请求体 POST

func NewFavoriteActionRequest

func NewFavoriteActionRequest() *FavoriteActionRequest

func (*FavoriteActionRequest) Descriptor deprecated

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

Deprecated: Use FavoriteActionRequest.ProtoReflect.Descriptor instead.

func (*FavoriteActionRequest) GetActionType

func (x *FavoriteActionRequest) GetActionType() int64

func (*FavoriteActionRequest) GetToken

func (x *FavoriteActionRequest) GetToken() string

func (*FavoriteActionRequest) GetVideoId

func (x *FavoriteActionRequest) GetVideoId() int64

func (*FavoriteActionRequest) ProtoMessage

func (*FavoriteActionRequest) ProtoMessage()

func (*FavoriteActionRequest) ProtoReflect

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

func (*FavoriteActionRequest) Reset

func (x *FavoriteActionRequest) Reset()

func (*FavoriteActionRequest) String

func (x *FavoriteActionRequest) String() string

func (*FavoriteActionRequest) Validate

func (r *FavoriteActionRequest) Validate() error

Validate 点赞/取消赞 参数校验

type FavoriteActionResponse

type FavoriteActionResponse struct {

	// 可以携带一些额外属性
	// @gotags: json:"mate"
	Mate map[string]string `` /* 139-byte string literal not displayed */
	// contains filtered or unexported fields
}

点赞操作响应体

func NewFavoriteActionResponse

func NewFavoriteActionResponse() *FavoriteActionResponse

NewFavoriteActionResponse 创建视频点赞响应体

func (*FavoriteActionResponse) Descriptor deprecated

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

Deprecated: Use FavoriteActionResponse.ProtoReflect.Descriptor instead.

func (*FavoriteActionResponse) GetMate

func (x *FavoriteActionResponse) GetMate() map[string]string

func (*FavoriteActionResponse) ProtoMessage

func (*FavoriteActionResponse) ProtoMessage()

func (*FavoriteActionResponse) ProtoReflect

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

func (*FavoriteActionResponse) Reset

func (x *FavoriteActionResponse) Reset()

func (*FavoriteActionResponse) String

func (x *FavoriteActionResponse) String() string

type FavoriteCountRequest

type FavoriteCountRequest struct {

	// 用户ID
	// @gotags: json:"user_id"
	UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id"`
	// 视频IDs
	// @gotags: json:"video_ids"
	VideoIds []int64 `protobuf:"varint,2,rep,packed,name=video_ids,json=videoIds,proto3" json:"video_ids"`
	// contains filtered or unexported fields
}

func NewFavoriteCountRequest

func NewFavoriteCountRequest() *FavoriteCountRequest

func (*FavoriteCountRequest) Descriptor deprecated

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

Deprecated: Use FavoriteCountRequest.ProtoReflect.Descriptor instead.

func (*FavoriteCountRequest) GetUserId

func (x *FavoriteCountRequest) GetUserId() int64

func (*FavoriteCountRequest) GetVideoIds

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

func (*FavoriteCountRequest) ProtoMessage

func (*FavoriteCountRequest) ProtoMessage()

func (*FavoriteCountRequest) ProtoReflect

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

func (*FavoriteCountRequest) Reset

func (x *FavoriteCountRequest) Reset()

func (*FavoriteCountRequest) String

func (x *FavoriteCountRequest) String() string

type FavoriteCountResponse

type FavoriteCountResponse struct {

	// 点赞的视频总数
	// @gotags: json:"favorite_count"
	FavoriteCount int64 `protobuf:"varint,1,opt,name=favorite_count,json=favoriteCount,proto3" json:"favorite_count"`
	// 获得的点赞数量
	// @gotags: json:"acquire_favorite_count"
	AcquireFavoriteCount int64 `protobuf:"varint,2,opt,name=acquire_favorite_count,json=acquireFavoriteCount,proto3" json:"acquire_favorite_count"`
	// contains filtered or unexported fields
}

用于喜欢总数、[用户喜欢列表、视频点赞总数]

func NewFavoriteCountResponse

func NewFavoriteCountResponse() *FavoriteCountResponse

func (*FavoriteCountResponse) Descriptor deprecated

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

Deprecated: Use FavoriteCountResponse.ProtoReflect.Descriptor instead.

func (*FavoriteCountResponse) GetAcquireFavoriteCount

func (x *FavoriteCountResponse) GetAcquireFavoriteCount() int64

func (*FavoriteCountResponse) GetFavoriteCount

func (x *FavoriteCountResponse) GetFavoriteCount() int64

func (*FavoriteCountResponse) ProtoMessage

func (*FavoriteCountResponse) ProtoMessage()

func (*FavoriteCountResponse) ProtoReflect

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

func (*FavoriteCountResponse) Reset

func (x *FavoriteCountResponse) Reset()

func (*FavoriteCountResponse) String

func (x *FavoriteCountResponse) String() string

type FavoriteListRequest

type FavoriteListRequest struct {

	// 用户id
	// @gotags: json:"user_id" form:"user_id" validate:"required" binding:"required"
	UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id" form:"user_id" validate:"required" binding:"required"`
	// 用户鉴权token
	// @gotags: json:"token" form:"token" binding:"required"
	Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token" form:"token" binding:"required"`
	// contains filtered or unexported fields
}

获取喜欢列表请求体

func NewFavoriteListRequest

func NewFavoriteListRequest() *FavoriteListRequest

func (*FavoriteListRequest) Descriptor deprecated

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

Deprecated: Use FavoriteListRequest.ProtoReflect.Descriptor instead.

func (*FavoriteListRequest) GetToken

func (x *FavoriteListRequest) GetToken() string

func (*FavoriteListRequest) GetUserId

func (x *FavoriteListRequest) GetUserId() int64

func (*FavoriteListRequest) ProtoMessage

func (*FavoriteListRequest) ProtoMessage()

func (*FavoriteListRequest) ProtoReflect

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

func (*FavoriteListRequest) Reset

func (x *FavoriteListRequest) Reset()

func (*FavoriteListRequest) String

func (x *FavoriteListRequest) String() string

func (*FavoriteListRequest) Validate

func (r *FavoriteListRequest) Validate() error

Validate 获取喜欢视频列表 参数校验

type FavoriteListResponse

type FavoriteListResponse struct {

	// 用户点赞视频列表
	// @gotags: json:"video_list"
	VideoList []*video.Video `protobuf:"bytes,5,rep,name=video_list,json=videoList,proto3" json:"video_list"`
	// contains filtered or unexported fields
}

获取喜欢列表响应体

func NewFavoriteListResponse

func NewFavoriteListResponse() *FavoriteListResponse

NewFavoriteListResponse 获取视频列表响应体

func (*FavoriteListResponse) Descriptor deprecated

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

Deprecated: Use FavoriteListResponse.ProtoReflect.Descriptor instead.

func (*FavoriteListResponse) GetVideoList

func (x *FavoriteListResponse) GetVideoList() []*video.Video

func (*FavoriteListResponse) ProtoMessage

func (*FavoriteListResponse) ProtoMessage()

func (*FavoriteListResponse) ProtoReflect

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

func (*FavoriteListResponse) Reset

func (x *FavoriteListResponse) Reset()

func (*FavoriteListResponse) String

func (x *FavoriteListResponse) String() string

type FavoriteMap

type FavoriteMap struct {

	// 用户 ID
	// @gotags: json:"favorite_count"
	FavoriteCount int64 `protobuf:"varint,1,opt,name=favorite_count,json=favoriteCount,proto3" json:"favorite_count"`
	// 是否点赞
	// @gotags: json:"is_favorite"
	IsFavorite bool `protobuf:"varint,2,opt,name=is_favorite,json=isFavorite,proto3" json:"is_favorite"`
	// contains filtered or unexported fields
}

func NewFavoriteMap

func NewFavoriteMap(count int64, isFavorite bool) *FavoriteMap

func (*FavoriteMap) Descriptor deprecated

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

Deprecated: Use FavoriteMap.ProtoReflect.Descriptor instead.

func (*FavoriteMap) GetFavoriteCount

func (x *FavoriteMap) GetFavoriteCount() int64

func (*FavoriteMap) GetIsFavorite

func (x *FavoriteMap) GetIsFavorite() bool

func (*FavoriteMap) ProtoMessage

func (*FavoriteMap) ProtoMessage()

func (*FavoriteMap) ProtoReflect

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

func (*FavoriteMap) Reset

func (x *FavoriteMap) Reset()

func (*FavoriteMap) String

func (x *FavoriteMap) String() string

type FavoriteMapRequest

type FavoriteMapRequest struct {

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

视频点赞 IDs

func NewFavoriteMapRequest

func NewFavoriteMapRequest() *FavoriteMapRequest

func (*FavoriteMapRequest) Descriptor deprecated

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

Deprecated: Use FavoriteMapRequest.ProtoReflect.Descriptor instead.

func (*FavoriteMapRequest) GetUserId

func (x *FavoriteMapRequest) GetUserId() int64

func (*FavoriteMapRequest) GetVideoIds

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

func (*FavoriteMapRequest) ProtoMessage

func (*FavoriteMapRequest) ProtoMessage()

func (*FavoriteMapRequest) ProtoReflect

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

func (*FavoriteMapRequest) Reset

func (x *FavoriteMapRequest) Reset()

func (*FavoriteMapRequest) String

func (x *FavoriteMapRequest) String() string

type FavoriteMapResponse

type FavoriteMapResponse struct {

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

视频点赞列表:map[userId] = favorite_count

func NewFavoriteMapResponse

func NewFavoriteMapResponse() *FavoriteMapResponse

func (*FavoriteMapResponse) Descriptor deprecated

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

Deprecated: Use FavoriteMapResponse.ProtoReflect.Descriptor instead.

func (*FavoriteMapResponse) GetFavoriteMap

func (x *FavoriteMapResponse) GetFavoriteMap() map[int64]*FavoriteMap

func (*FavoriteMapResponse) ProtoMessage

func (*FavoriteMapResponse) ProtoMessage()

func (*FavoriteMapResponse) ProtoReflect

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

func (*FavoriteMapResponse) Reset

func (x *FavoriteMapResponse) Reset()

func (*FavoriteMapResponse) String

func (x *FavoriteMapResponse) String() string

type FavoritePo

type FavoritePo struct {

	// ID
	// @gotags: json:"id"
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id"`
	// 用户ID
	// @gotags: json:"user_id"
	UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id"`
	// 视频ID
	// @gotags: json:"video_id"
	VideoId int64 `protobuf:"varint,3,opt,name=video_id,json=videoId,proto3" json:"video_id"`
	// contains filtered or unexported fields
}

点赞信息Module TODO:调整为联合主键

func NewFavoritePo

func NewFavoritePo() *FavoritePo

NewFavoritePo 构建Po

func (*FavoritePo) Descriptor deprecated

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

Deprecated: Use FavoritePo.ProtoReflect.Descriptor instead.

func (*FavoritePo) GetId

func (x *FavoritePo) GetId() int64

func (*FavoritePo) GetUserId

func (x *FavoritePo) GetUserId() int64

func (*FavoritePo) GetVideoId

func (x *FavoritePo) GetVideoId() int64

func (*FavoritePo) ProtoMessage

func (*FavoritePo) ProtoMessage()

func (*FavoritePo) ProtoReflect

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

func (*FavoritePo) Reset

func (x *FavoritePo) Reset()

func (*FavoritePo) String

func (x *FavoritePo) String() string

func (*FavoritePo) TableName

func (*FavoritePo) TableName() string

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

type ServiceClient

type ServiceClient interface {
	// 点赞/取消点赞 操作
	FavoriteAction(ctx context.Context, in *FavoriteActionRequest, opts ...grpc.CallOption) (*FavoriteActionResponse, error)
	// 获取喜欢列表
	FavoriteList(ctx context.Context, in *FavoriteListRequest, opts ...grpc.CallOption) (*FavoriteListResponse, error)
	// 获取 1、用户喜欢列表的数目 2、获取视频点赞数
	FavoriteCount(ctx context.Context, in *FavoriteCountRequest, opts ...grpc.CallOption) (*FavoriteCountResponse, error)
	// 获取视频点赞数量 map[videoId] = favorite_count + isFavorite
	FavoriteCountMap(ctx context.Context, in *FavoriteMapRequest, opts ...grpc.CallOption) (*FavoriteMapResponse, 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 {
	// 点赞/取消点赞 操作
	FavoriteAction(context.Context, *FavoriteActionRequest) (*FavoriteActionResponse, error)
	// 获取喜欢列表
	FavoriteList(context.Context, *FavoriteListRequest) (*FavoriteListResponse, error)
	// 获取 1、用户喜欢列表的数目 2、获取视频点赞数
	FavoriteCount(context.Context, *FavoriteCountRequest) (*FavoriteCountResponse, error)
	// 获取视频点赞数量 map[videoId] = favorite_count + isFavorite
	FavoriteCountMap(context.Context, *FavoriteMapRequest) (*FavoriteMapResponse, 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) FavoriteAction

func (UnimplementedServiceServer) FavoriteCount

func (UnimplementedServiceServer) FavoriteCountMap

func (UnimplementedServiceServer) FavoriteList

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