logic

package
v0.0.0-...-611b6d6 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package logic provides the business logic for the application

Index

Constants

View Source
const ContextKey = "owner_id"

ContextKey is the key of user id in context

Variables

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

CommentAction 评论逻辑

type CommentActionParam

type CommentActionParam struct {
	fx.In
	UserQuery      dal.UserQuery
	CommentCommand dal.CommentCommand
}

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

func NewFeed

func NewFeed(param FeedParam) *Feed

NewFeed creates a new feed logic

func (*Feed) Feed

func (f *Feed) Feed(ctx context.Context, req *types.FeedReq) (resp *types.FeedResp, err error)

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

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 NewJWTSigner

func NewJWTSigner(config *config.Config) *JWTSigner

NewJWTSigner 生成 jwt 签名器

func (*JWTSigner) AddWhiteList

func (j *JWTSigner) AddWhiteList(paths []string)

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 NewLike

func NewLike(param LikeParam) *Like

NewLike returns a new Like logic

func (*Like) Like

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

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

func NewLogin

func NewLogin(param LoginParam) *Login

NewLogin is the constructor for Login

func (*Login) Login

func (l *Login) Login(ctx context.Context, req *types.UserReq) (resp *types.UserResp, err error)

Login 登陆逻辑

type LoginParam

type LoginParam struct {
	fx.In
	UserQuery dal.UserQuery
	J         *JWTSigner
}

LoginParam is the parameter for NewLogin

type Minio

type Minio struct {
	// contains filtered or unexported fields
}

Minio is the implementation of Uploader

func NewMinio

func NewMinio(c *config.Config) (*Minio, error)

NewMinio returns a new *Minio

func (*Minio) Upload

func (m *Minio) Upload(ctx context.Context, input UploadInput) (string, error)

Upload uploads a file, returns the URL of the uploaded file

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

func (*Register) Register

func (l *Register) Register(ctx context.Context, req *types.UserReq) (resp *types.UserResp, err error)

Register 注册逻辑 注册账号,并把加密后的账号信息存入数据库,生成 token 返回

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 NewUpload

func NewUpload(param UploadParam) *Upload

NewUpload returns a new Upload logic

func (*Upload) UploadVideo

func (u *Upload) UploadVideo(c context.Context, req *types.UploadReq) (*types.UploadResp, error)

UploadVideo publishes a video

type UploadInput

type UploadInput struct {
	Key   string
	Value io.Reader
}

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 获取用户信息

type UserProfileParam

type UserProfileParam struct {
	fx.In
	UserModel dal.UserQuery
}

UserProfileParam is the parameter for NewUserProfile

Jump to

Keyboard shortcuts

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