video

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: 13 Imported by: 4

Documentation

Overview

@Author: Ciusyan 2023/2/7

Index

Constants

View Source
const (
	AppName = "video"
)

Variables

View Source
var File_apps_video_pb_video_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "dousheng.video.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "FeedVideos",
			Handler:    _Service_FeedVideos_Handler,
		},
		{
			MethodName: "PublishVideo",
			Handler:    _Service_PublishVideo_Handler,
		},
		{
			MethodName: "PublishList",
			Handler:    _Service_PublishList_Handler,
		},
		{
			MethodName: "GetVideo",
			Handler:    _Service_GetVideo_Handler,
		},
		{
			MethodName: "ComposeVideoCount",
			Handler:    _Service_ComposeVideoCount_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "apps/video/pb/video.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 FeedSetResponse

type FeedSetResponse struct {

	// 本次返回的视频中,发布最早的时间,作为下次请求的latest_time
	// @gotags: json:"next_time"
	NextTime *int64 `protobuf:"varint,2,opt,name=next_time,json=nextTime,proto3,oneof" json:"next_time"`
	// 视频列表
	// @gotags: json:"video_list"
	VideoList []*Video `protobuf:"bytes,1,rep,name=video_list,json=videoList,proto3" json:"video_list"`
	// contains filtered or unexported fields
}

func NewFeedSet

func NewFeedSet() *FeedSetResponse

func (*FeedSetResponse) Descriptor deprecated

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

Deprecated: Use FeedSetResponse.ProtoReflect.Descriptor instead.

func (*FeedSetResponse) GetNextTime

func (x *FeedSetResponse) GetNextTime() int64

func (*FeedSetResponse) GetVideoList

func (x *FeedSetResponse) GetVideoList() []*Video

func (*FeedSetResponse) ProtoMessage

func (*FeedSetResponse) ProtoMessage()

func (*FeedSetResponse) ProtoReflect

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

func (*FeedSetResponse) Reset

func (x *FeedSetResponse) Reset()

func (*FeedSetResponse) String

func (x *FeedSetResponse) String() string

type FeedVideosRequest

type FeedVideosRequest struct {

	// 分页参数
	// @gotags: json:"page"
	Page *PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page"`
	// 可选参数,限制返回视频的最新投稿时间戳,精确到秒,不填表示当前时间
	// @gotags: json:"latest_time" form:"latest_time"
	LatestTime *int64 `protobuf:"varint,2,opt,name=latest_time,json=latestTime,proto3,oneof" json:"latest_time" form:"latest_time"`
	// 可选参数,登录用户设置
	// @gotags: json:"token" form:"token"
	Token *string `protobuf:"bytes,3,opt,name=token,proto3,oneof" json:"token" form:"token"`
	// contains filtered or unexported fields
}

func NewFeedVideosRequest

func NewFeedVideosRequest() *FeedVideosRequest

func (*FeedVideosRequest) Descriptor deprecated

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

Deprecated: Use FeedVideosRequest.ProtoReflect.Descriptor instead.

func (*FeedVideosRequest) GetLatestTime

func (x *FeedVideosRequest) GetLatestTime() int64

func (*FeedVideosRequest) GetPage

func (x *FeedVideosRequest) GetPage() *PageRequest

func (*FeedVideosRequest) GetToken

func (x *FeedVideosRequest) GetToken() string

func (*FeedVideosRequest) ProtoMessage

func (*FeedVideosRequest) ProtoMessage()

func (*FeedVideosRequest) ProtoReflect

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

func (*FeedVideosRequest) Reset

func (x *FeedVideosRequest) Reset()

func (*FeedVideosRequest) String

func (x *FeedVideosRequest) String() string

type GetVideoRequest

type GetVideoRequest struct {

	// 视频ID
	// @gotags: json:"video_id" validate:"required"
	VideoId int64 `protobuf:"varint,1,opt,name=video_id,json=videoId,proto3" json:"video_id" validate:"required"`
	// 用户鉴权Token
	// @gotags: json:"token" validate:"required"
	Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token" validate:"required"`
	// contains filtered or unexported fields
}

视频ID

func NewGetVideoRequest

func NewGetVideoRequest() *GetVideoRequest

func (*GetVideoRequest) Descriptor deprecated

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

Deprecated: Use GetVideoRequest.ProtoReflect.Descriptor instead.

func (*GetVideoRequest) GetToken

func (x *GetVideoRequest) GetToken() string

func (*GetVideoRequest) GetVideoId

func (x *GetVideoRequest) GetVideoId() int64

func (*GetVideoRequest) ProtoMessage

func (*GetVideoRequest) ProtoMessage()

func (*GetVideoRequest) ProtoReflect

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

func (*GetVideoRequest) Reset

func (x *GetVideoRequest) Reset()

func (*GetVideoRequest) String

func (x *GetVideoRequest) String() string

func (*GetVideoRequest) Validate

func (r *GetVideoRequest) Validate() error

type PageRequest

type PageRequest struct {

	// 每页数据数量
	// @gotags: json:"page_size" form:"page_size"
	PageSize uint64 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size" form:"page_size"`
	// 第几页
	// @gotags: json:"page_number" form:"page_number"
	PageNumber uint64 `protobuf:"varint,2,opt,name=page_number,json=pageNumber,proto3" json:"page_number" form:"page_number"`
	// 偏移量
	// @gotags: json:"offset" form:"offset"
	Offset int64 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset" form:"offset"`
	// contains filtered or unexported fields
}

分页请求参数 TODO:可以放在公共模块

func NewPageRequest

func NewPageRequest() *PageRequest

func (*PageRequest) Descriptor deprecated

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

Deprecated: Use PageRequest.ProtoReflect.Descriptor instead.

func (*PageRequest) GetOffset

func (x *PageRequest) GetOffset() int64

func (*PageRequest) GetPageNumber

func (x *PageRequest) GetPageNumber() uint64

func (*PageRequest) GetPageSize

func (x *PageRequest) GetPageSize() uint64

func (*PageRequest) ProtoMessage

func (*PageRequest) ProtoMessage()

func (*PageRequest) ProtoReflect

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

func (*PageRequest) Reset

func (x *PageRequest) Reset()

func (*PageRequest) String

func (x *PageRequest) String() string

type PublishListCountRequest

type PublishListCountRequest 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"`
	// contains filtered or unexported fields
}

用户发布列表数量的请求 model

func NewPublishListCountRequest

func NewPublishListCountRequest(userId int64) *PublishListCountRequest

func (*PublishListCountRequest) Descriptor deprecated

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

Deprecated: Use PublishListCountRequest.ProtoReflect.Descriptor instead.

func (*PublishListCountRequest) GetUserId

func (x *PublishListCountRequest) GetUserId() int64

func (*PublishListCountRequest) ProtoMessage

func (*PublishListCountRequest) ProtoMessage()

func (*PublishListCountRequest) ProtoReflect

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

func (*PublishListCountRequest) Reset

func (x *PublishListCountRequest) Reset()

func (*PublishListCountRequest) String

func (x *PublishListCountRequest) String() string

type PublishListCountResponse

type PublishListCountResponse struct {

	// 用户发布的视频数目
	// @gotags: json:"publish_count"
	PublishCount int64 `protobuf:"varint,1,opt,name=publish_count,json=publishCount,proto3" json:"publish_count"`
	// 获得的总的点赞数量
	// @gotags: json:"acquire_total_favorite"
	AcquireTotalFavorite int64 `protobuf:"varint,2,opt,name=acquire_total_favorite,json=acquireTotalFavorite,proto3" json:"acquire_total_favorite"`
	// contains filtered or unexported fields
}

func NewPublishListCountResponse

func NewPublishListCountResponse() *PublishListCountResponse

func (*PublishListCountResponse) Descriptor deprecated

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

Deprecated: Use PublishListCountResponse.ProtoReflect.Descriptor instead.

func (*PublishListCountResponse) GetAcquireTotalFavorite

func (x *PublishListCountResponse) GetAcquireTotalFavorite() int64

func (*PublishListCountResponse) GetPublishCount

func (x *PublishListCountResponse) GetPublishCount() int64

func (*PublishListCountResponse) ProtoMessage

func (*PublishListCountResponse) ProtoMessage()

func (*PublishListCountResponse) ProtoReflect

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

func (*PublishListCountResponse) Reset

func (x *PublishListCountResponse) Reset()

func (*PublishListCountResponse) String

func (x *PublishListCountResponse) String() string

type PublishListRequest

type PublishListRequest 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
}

发布列表的 请求 model

func NewPublishListRequest

func NewPublishListRequest() *PublishListRequest

func (*PublishListRequest) Descriptor deprecated

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

Deprecated: Use PublishListRequest.ProtoReflect.Descriptor instead.

func (*PublishListRequest) GetToken

func (x *PublishListRequest) GetToken() string

func (*PublishListRequest) GetUserId

func (x *PublishListRequest) GetUserId() int64

func (*PublishListRequest) ProtoMessage

func (*PublishListRequest) ProtoMessage()

func (*PublishListRequest) ProtoReflect

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

func (*PublishListRequest) Reset

func (x *PublishListRequest) Reset()

func (*PublishListRequest) String

func (x *PublishListRequest) String() string

func (*PublishListRequest) Validate

func (r *PublishListRequest) Validate() error

type PublishListResponse

type PublishListResponse struct {

	// 用户发布的视频列表
	// @gotags: json:"video_list"
	VideoList []*Video `protobuf:"bytes,1,rep,name=video_list,json=videoList,proto3" json:"video_list"`
	// contains filtered or unexported fields
}

func NewPublishListResponse

func NewPublishListResponse() *PublishListResponse

func (*PublishListResponse) Descriptor deprecated

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

Deprecated: Use PublishListResponse.ProtoReflect.Descriptor instead.

func (*PublishListResponse) GetVideoList

func (x *PublishListResponse) GetVideoList() []*Video

func (*PublishListResponse) ProtoMessage

func (*PublishListResponse) ProtoMessage()

func (*PublishListResponse) ProtoReflect

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

func (*PublishListResponse) Reset

func (x *PublishListResponse) Reset()

func (*PublishListResponse) String

func (x *PublishListResponse) String() string

type PublishVideoRequest

type PublishVideoRequest struct {

	// 用户鉴权Token
	// @gotags: json:"token" form:"token" binding:"required"
	Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token" form:"token" binding:"required"`
	// 视频标题
	// @gotags: json:"title" form:"title" binding:"required" validate:"required"
	Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title" form:"title" binding:"required" validate:"required"`
	// 视频播放地址 [经过文件上传后设置]
	// @gotags: json:"play_url" binding:"-" validate:"required"
	PlayUrl string `protobuf:"bytes,3,opt,name=play_url,json=playUrl,proto3" json:"play_url" binding:"-" validate:"required"`
	// 视频封面地址 [经过文件上传后设置]
	// @gotags: json:"cover_url" binding:"-" validate:"required"
	CoverUrl string `protobuf:"bytes,4,opt,name=cover_url,json=coverUrl,proto3" json:"cover_url" binding:"-" validate:"required"`
	// 用户ID [经过Token认证过后,在设置]
	// @gotags: json:"user_id" binding:"-" validate:"required"
	UserId int64 `protobuf:"varint,5,opt,name=user_id,json=userId,proto3" json:"user_id" binding:"-" validate:"required"`
	// contains filtered or unexported fields
}

func NewPublishVideoRequest

func NewPublishVideoRequest() *PublishVideoRequest

func (*PublishVideoRequest) Descriptor deprecated

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

Deprecated: Use PublishVideoRequest.ProtoReflect.Descriptor instead.

func (*PublishVideoRequest) GetCoverUrl

func (x *PublishVideoRequest) GetCoverUrl() string

func (*PublishVideoRequest) GetPlayUrl

func (x *PublishVideoRequest) GetPlayUrl() string

func (*PublishVideoRequest) GetTitle

func (x *PublishVideoRequest) GetTitle() string

func (*PublishVideoRequest) GetToken

func (x *PublishVideoRequest) GetToken() string

func (*PublishVideoRequest) GetUserId

func (x *PublishVideoRequest) GetUserId() int64

func (*PublishVideoRequest) ProtoMessage

func (*PublishVideoRequest) ProtoMessage()

func (*PublishVideoRequest) ProtoReflect

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

func (*PublishVideoRequest) Reset

func (x *PublishVideoRequest) Reset()

func (*PublishVideoRequest) String

func (x *PublishVideoRequest) String() string

func (*PublishVideoRequest) Validate

func (r *PublishVideoRequest) Validate() error

Validate 参数校验

type PublishVideoResponse

type PublishVideoResponse struct {

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

func NewPublishVideoResponse

func NewPublishVideoResponse() *PublishVideoResponse

func (*PublishVideoResponse) Descriptor deprecated

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

Deprecated: Use PublishVideoResponse.ProtoReflect.Descriptor instead.

func (*PublishVideoResponse) GetMate

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

func (*PublishVideoResponse) ProtoMessage

func (*PublishVideoResponse) ProtoMessage()

func (*PublishVideoResponse) ProtoReflect

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

func (*PublishVideoResponse) Reset

func (x *PublishVideoResponse) Reset()

func (*PublishVideoResponse) String

func (x *PublishVideoResponse) String() string

type ServiceClient

type ServiceClient interface {
	// 视频 feed 流
	FeedVideos(ctx context.Context, in *FeedVideosRequest, opts ...grpc.CallOption) (*FeedSetResponse, error)
	// 视频发布
	PublishVideo(ctx context.Context, in *PublishVideoRequest, opts ...grpc.CallOption) (*PublishVideoResponse, error)
	// 用户发布视频的列表
	PublishList(ctx context.Context, in *PublishListRequest, opts ...grpc.CallOption) (*PublishListResponse, error)
	// 根据视频ID获取视频信息
	GetVideo(ctx context.Context, in *GetVideoRequest, opts ...grpc.CallOption) (*Video, error)
	// 根据用户ID获取 [用户发布视频数目 用户视频的获赞总数]
	ComposeVideoCount(ctx context.Context, in *PublishListCountRequest, opts ...grpc.CallOption) (*PublishListCountResponse, 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 {
	// 视频 feed 流
	FeedVideos(context.Context, *FeedVideosRequest) (*FeedSetResponse, error)
	// 视频发布
	PublishVideo(context.Context, *PublishVideoRequest) (*PublishVideoResponse, error)
	// 用户发布视频的列表
	PublishList(context.Context, *PublishListRequest) (*PublishListResponse, error)
	// 根据视频ID获取视频信息
	GetVideo(context.Context, *GetVideoRequest) (*Video, error)
	// 根据用户ID获取 [用户发布视频数目 用户视频的获赞总数]
	ComposeVideoCount(context.Context, *PublishListCountRequest) (*PublishListCountResponse, 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) ComposeVideoCount

func (UnimplementedServiceServer) FeedVideos

func (UnimplementedServiceServer) GetVideo

func (UnimplementedServiceServer) PublishList

func (UnimplementedServiceServer) PublishVideo

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.

type Video

type Video struct {

	// 视频唯一标识
	// @gotags: json:"id"
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id"`
	// 视频作者
	// @gotags: json:"author"
	Author *user.User `protobuf:"bytes,2,opt,name=author,proto3" json:"author"`
	// 视频播放地址
	// @gotags: json:"play_url"
	PlayUrl string `protobuf:"bytes,3,opt,name=play_url,json=playUrl,proto3" json:"play_url"`
	// 视频封面地址
	// @gotags: json:"cover_url"
	CoverUrl string `protobuf:"bytes,4,opt,name=cover_url,json=coverUrl,proto3" json:"cover_url"`
	// 视频的点赞总数
	// @gotags: json:"favorite_count"
	FavoriteCount int64 `protobuf:"varint,5,opt,name=favorite_count,json=favoriteCount,proto3" json:"favorite_count"`
	// 视频的评论总数
	// @gotags: json:"comment_count"
	CommentCount int64 `protobuf:"varint,6,opt,name=comment_count,json=commentCount,proto3" json:"comment_count"`
	// true-已点赞,false-未点赞
	// @gotags: json:"is_favorite"
	IsFavorite bool `protobuf:"varint,7,opt,name=is_favorite,json=isFavorite,proto3" json:"is_favorite"`
	// 视频标题
	// @gotags: json:"title"
	Title string `protobuf:"bytes,8,opt,name=title,proto3" json:"title"`
	// contains filtered or unexported fields
}

func (*Video) Descriptor deprecated

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

Deprecated: Use Video.ProtoReflect.Descriptor instead.

func (*Video) GetAuthor

func (x *Video) GetAuthor() *user.User

func (*Video) GetCommentCount

func (x *Video) GetCommentCount() int64

func (*Video) GetCoverUrl

func (x *Video) GetCoverUrl() string

func (*Video) GetFavoriteCount

func (x *Video) GetFavoriteCount() int64

func (*Video) GetId

func (x *Video) GetId() int64

func (*Video) GetIsFavorite

func (x *Video) GetIsFavorite() bool

func (*Video) GetPlayUrl

func (x *Video) GetPlayUrl() string

func (*Video) GetTitle

func (x *Video) GetTitle() string

func (*Video) ProtoMessage

func (*Video) ProtoMessage()

func (*Video) ProtoReflect

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

func (*Video) Reset

func (x *Video) Reset()

func (*Video) String

func (x *Video) String() string

type VideoPo

type VideoPo struct {

	// 视频唯一标识
	// @gotags: json:"id"
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id"`
	// 视频播放地址
	// @gotags: json:"play_url"
	PlayUrl string `protobuf:"bytes,2,opt,name=play_url,json=playUrl,proto3" json:"play_url"`
	// 视频封面地址
	// @gotags: json:"cover_url"
	CoverUrl string `protobuf:"bytes,3,opt,name=cover_url,json=coverUrl,proto3" json:"cover_url"`
	// 视频标题
	// @gotags: json:"title"
	Title string `protobuf:"bytes,4,opt,name=title,proto3" json:"title"`
	// 视频作者ID
	// @gotags: json:"author_id"
	AuthorId int64 `protobuf:"varint,5,opt,name=author_id,json=authorId,proto3" json:"author_id"`
	// @gotags: json:"created_at"
	CreatedAt int64 `protobuf:"varint,6,opt,name=created_at,json=createdAt,proto3" json:"created_at"`
	// contains filtered or unexported fields
}

func NewVideoPo

func NewVideoPo() *VideoPo

func NewVideoPoWithSave

func NewVideoPoWithSave(req *PublishVideoRequest) *VideoPo

func (*VideoPo) Descriptor deprecated

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

Deprecated: Use VideoPo.ProtoReflect.Descriptor instead.

func (*VideoPo) GetAuthorId

func (x *VideoPo) GetAuthorId() int64

func (*VideoPo) GetCoverUrl

func (x *VideoPo) GetCoverUrl() string

func (*VideoPo) GetCreatedAt

func (x *VideoPo) GetCreatedAt() int64

func (*VideoPo) GetId

func (x *VideoPo) GetId() int64

func (*VideoPo) GetPlayUrl

func (x *VideoPo) GetPlayUrl() string

func (*VideoPo) GetTitle

func (x *VideoPo) GetTitle() string

func (*VideoPo) Po2vo

func (po *VideoPo) Po2vo() *Video

Po2vo 将 videoPo -> video

func (*VideoPo) ProtoMessage

func (*VideoPo) ProtoMessage()

func (*VideoPo) ProtoReflect

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

func (*VideoPo) Reset

func (x *VideoPo) Reset()

func (*VideoPo) String

func (x *VideoPo) String() string

func (*VideoPo) TableName

func (*VideoPo) TableName() string

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

Directories

Path Synopsis
Package impl @Author: Ciusyan 2023/3/3
Package impl @Author: Ciusyan 2023/3/3

Jump to

Keyboard shortcuts

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