Documentation ¶
Overview ¶
Package logic provides the business logic for the application
Index ¶
- Constants
- Variables
- type CommentAction
- type CommentActionParam
- type CommentList
- type CommentListParam
- type Feed
- type FeedParam
- type FollowAction
- type FollowActionParam
- type JWTSigner
- type Like
- type LikeList
- type LikeListParam
- type LikeParam
- type Login
- type LoginParam
- type Minio
- type PublishList
- type PublishListParam
- type Register
- type RegisterParam
- type Upload
- type UploadInput
- type UploadParam
- type Uploader
- type UserProfile
- type UserProfileParam
Constants ¶
const ContextKey = "owner_id"
ContextKey is the key of user id in context
Variables ¶
var Module = fx.Module("logic", fx.Provide( NewRegister, NewLogin, NewFeed, NewUpload, NewUserProfile, NewPublishList, NewLike, NewLikeList, NewCommentAction, NewCommentList, NewFollowAction, NewJWTSigner, fx.Annotate(NewMinio, fx.As(new(Uploader))), ))
Module is the business logic module It provides the business logic for the application
Functions ¶
This section is empty.
Types ¶
type CommentAction ¶
type CommentAction struct {
// contains filtered or unexported fields
}
CommentAction is the comment logic layer struct
func NewCommentAction ¶
func NewCommentAction(param CommentActionParam) *CommentAction
NewCommentAction returns a new CommentAction logic
func (*CommentAction) CommentAction ¶
func (c *CommentAction) CommentAction(ctx context.Context, req *types.CommentActionReq) (*types.CommentActionResp, error)
CommentAction 评论逻辑
type CommentActionParam ¶
CommentActionParam is the parameter for NewCommentAction
type CommentList ¶
type CommentList struct {
// contains filtered or unexported fields
}
CommentList is the comment logic layer struct
func NewCommentList ¶
func NewCommentList(param CommentListParam) *CommentList
NewCommentList returns a new CommentList logic
func (*CommentList) CommentList ¶
func (c *CommentList) CommentList(ctx context.Context, req *types.CommentListReq) (resp *types.CommentListResp, err error)
CommentList 评论列表逻辑
type CommentListParam ¶
type CommentListParam struct { fx.In UserQuery dal.UserQuery CommentQuery dal.CommentQuery RelationQuery dal.RelationQuery }
CommentListParam is the parameter for NewCommentList
type Feed ¶
type Feed struct {
// contains filtered or unexported fields
}
Feed is the logic for feed
type FeedParam ¶
type FeedParam struct { fx.In VideoQuery dal.VideoQuery UserQuery dal.UserQuery LikeQuery dal.LikeQuery }
FeedParam is the parameter for NewFeed
type FollowAction ¶
type FollowAction struct {
// contains filtered or unexported fields
}
FollowAction is the relation logic layer struct
func NewFollowAction ¶
func NewFollowAction(param FollowActionParam) *FollowAction
NewFollowAction returns a new FollowAction logic
func (*FollowAction) Follow ¶
func (r *FollowAction) Follow(c context.Context, req *types.RelationActionReq) (*types.RelationActionResp, error)
Follow handles the follow action
type FollowActionParam ¶
type FollowActionParam struct { fx.In RelationCommand dal.RelationCommand }
FollowActionParam is the param for NewFollowAction
type JWTSigner ¶
type JWTSigner struct {
// contains filtered or unexported fields
}
JWTSigner jwt 签名器
func (*JWTSigner) AddWhiteList ¶
AddWhiteList 添加白名单列表
func (*JWTSigner) NewJWTMiddleware ¶
func (j *JWTSigner) NewJWTMiddleware() echo.MiddlewareFunc
NewJWTMiddleware 生成 jwt 中间件
type Like ¶
type Like struct {
// contains filtered or unexported fields
}
Like is the like logic layer struct
func (*Like) Like ¶
func (l *Like) Like(c context.Context, req *types.FavoriteActionReq) (*types.FavoriteActionResp, error)
Like is the like logic handle the like action
type LikeList ¶
type LikeList struct {
// contains filtered or unexported fields
}
LikeList is the like list logic layer struct
func NewLikeList ¶
func NewLikeList(param LikeListParam) *LikeList
NewLikeList returns a new LikeList logic
func (*LikeList) LikeList ¶
func (l *LikeList) LikeList(ctx context.Context, req *types.FavoriteListReq) (*types.FavoriteListResp, error)
LikeList is the like list logic handle the like list
type LikeListParam ¶
type LikeListParam struct { fx.In LikeModel dal.LikeQuery UserModel dal.UserQuery VideoModel dal.VideoQuery }
LikeListParam is the param for NewLikeList
type LikeParam ¶
type LikeParam struct { fx.In LikeCommand dal.LikeCommand }
LikeParam is the param for NewLike
type Login ¶
type Login struct {
// contains filtered or unexported fields
}
Login is the logic for login
type LoginParam ¶
LoginParam is the parameter for NewLogin
type Minio ¶
type Minio struct {
// contains filtered or unexported fields
}
Minio is the implementation of Uploader
type PublishList ¶
type PublishList struct {
// contains filtered or unexported fields
}
PublishList is the logic for publish list
func NewPublishList ¶
func NewPublishList(param PublishListParam) *PublishList
NewPublishList returns a new PublishList logic
func (*PublishList) PublishList ¶
func (p *PublishList) PublishList(ctx context.Context, req *types.PublishListReq) (*types.PublishListResp, error)
PublishList gets publish list
type PublishListParam ¶
type PublishListParam struct { fx.In VideoQuery dal.VideoQuery UserQuery dal.UserQuery LikeQuery dal.LikeQuery }
PublishListParam is the parameter for NewPublishList
type Register ¶
type Register struct {
// contains filtered or unexported fields
}
Register is the logic for register
func NewRegister ¶
func NewRegister(param RegisterParam) *Register
NewRegister returns a new Register logic
type RegisterParam ¶
type RegisterParam struct { fx.In UserCommand dal.UserCommand J *JWTSigner }
RegisterParam is the parameter for NewRegister
type Upload ¶
type Upload struct {
// contains filtered or unexported fields
}
Upload is the logic for upload video
func (*Upload) UploadVideo ¶
UploadVideo publishes a video
type UploadInput ¶
UploadInput is the input parameter for Uploader.Upload
type UploadParam ¶
type UploadParam struct { fx.In VideoCommand dal.VideoCommand Helper Uploader }
UploadParam is the param for NewUpload
type Uploader ¶
type Uploader interface { // Upload uploads a file, returns the URL of the uploaded file Upload(ctx context.Context, input UploadInput) (url string, err error) }
Uploader is the interface for uploading file
type UserProfile ¶
type UserProfile struct {
// contains filtered or unexported fields
}
UserProfile is the logic for querying user profile
func NewUserProfile ¶
func NewUserProfile(param UserProfileParam) *UserProfile
NewUserProfile returns a new UserProfile logic
func (*UserProfile) GetProfile ¶
func (u *UserProfile) GetProfile(ctx context.Context, req *types.UserInfoReq) (*types.UserInfoResp, error)
GetProfile 获取用户信息 根据用户 id 获取用户信息