Documentation
¶
Index ¶
- Variables
- type Greeter
- type GreeterRepo
- type GreeterUsecase
- type Inter
- type InterRepo
- type InterStat
- type InterUsecase
- func (uc *InterUsecase) CancelCollect(ctx context.Context, biz string, bizID, userID, collectionID int64) error
- func (uc *InterUsecase) CancelLike(ctx context.Context, biz string, bizID, userID int64) error
- func (uc *InterUsecase) Collect(ctx context.Context, biz string, bizID, userID, collectionID int64) error
- func (uc *InterUsecase) IncrReadCount(ctx context.Context, biz string, id int64) error
- func (uc *InterUsecase) Like(ctx context.Context, biz string, bizID, userID int64) error
- func (uc *InterUsecase) Stat(ctx context.Context, biz string, bizID, userID int64) (*InterStat, error)
- type User
- type UserRepo
- type UserUsecase
- func (uc *UserUsecase) CreateUser(ctx context.Context, g *User) error
- func (uc *UserUsecase) GetUser(ctx context.Context, id int64) (*User, error)
- func (uc *UserUsecase) GetUserByIdList(ctx context.Context, userIdList []int64) ([]*User, error)
- func (uc *UserUsecase) UpdateUser(ctx context.Context, g *User) error
- type Video
- type VideoRepo
- type VideoUsecase
- func (uc *VideoUsecase) CreateVideo(ctx context.Context, g *Video) error
- func (uc *VideoUsecase) Feed(ctx context.Context, userID, lastTime int64, limit int) ([]*Video, error)
- func (uc *VideoUsecase) GetVideo(ctx context.Context, id int64) (*Video, error)
- func (uc *VideoUsecase) GetVideoByIdList(ctx context.Context, videoIdList []int64) ([]*Video, error)
- func (uc *VideoUsecase) GetVideoByUserID(ctx context.Context, userID, lastTime int64, limit int) ([]*Video, error)
- func (uc *VideoUsecase) UpdateVideo(ctx context.Context, g *Video) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUserNotFound is user not found. ErrUserNotFound = errors.NotFound(v1.ErrorReason_USER_NOT_FOUND.String(), "user not found") )
var ProviderSet = wire.NewSet(NewGreeterUsecase, NewUserUsecase, NewVideoUsecase, NewInterUsecase)
ProviderSet is biz providers.
Functions ¶
This section is empty.
Types ¶
type GreeterRepo ¶
type GreeterRepo interface { Save(context.Context, *Greeter) (*Greeter, error) Update(context.Context, *Greeter) (*Greeter, error) FindByID(context.Context, int64) (*Greeter, error) ListByHello(context.Context, string) ([]*Greeter, error) ListAll(context.Context) ([]*Greeter, error) }
GreeterRepo is a Greater repo.
type GreeterUsecase ¶
type GreeterUsecase struct {
// contains filtered or unexported fields
}
GreeterUsecase is a Greeter usecase.
func NewGreeterUsecase ¶
func NewGreeterUsecase(repo GreeterRepo, logger log.Logger) *GreeterUsecase
NewGreeterUsecase new a Greeter usecase.
func (*GreeterUsecase) CreateGreeter ¶
CreateGreeter creates a Greeter, and returns the new Greeter.
type Inter ¶
type Inter struct { ID int64 `json:"id"` BizID int64 `json:"biz_id"` Biz string `json:"biz"` ReadCnt int64 `json:"read_cnt"` LikeCnt int64 `json:"like_cnt"` CollectCnt int64 `json:"collect_cnt"` IsDeleted int32 `json:"is_deleted"` // 是否删除 CreateTime time.Time `json:"create_time"` // 创建时间 UpdateTime time.Time `json:"update_time"` // 更新时间 }
Inter is a Inter model.
type InterRepo ¶
type InterRepo interface { IncrReadCount(c context.Context, biz string, id int64) error Like(c context.Context, biz string, bizID, userID int64) error CancelLike(c context.Context, biz string, bizID, userID int64) error Collect(c context.Context, biz string, bizID, userID, collectionID int64) error CancelCollect(c context.Context, biz string, bizID, userID, collectionID int64) error Stat(c context.Context, biz string, bizID, userID int64) (*InterStat, error) }
InterRepo is a Greater repo.
type InterUsecase ¶
type InterUsecase struct {
// contains filtered or unexported fields
}
InterUsecase is a Inter usecase.
func NewInterUsecase ¶
func NewInterUsecase(repo InterRepo, logger log.Logger) *InterUsecase
NewInterUsecase new a Inter usecase.
func (*InterUsecase) CancelCollect ¶
func (uc *InterUsecase) CancelCollect(ctx context.Context, biz string, bizID, userID, collectionID int64) error
CancelCollect .
func (*InterUsecase) CancelLike ¶
CancelLike .
func (*InterUsecase) Collect ¶
func (uc *InterUsecase) Collect(ctx context.Context, biz string, bizID, userID, collectionID int64) error
Collect .
func (*InterUsecase) IncrReadCount ¶
IncrReadCount .
type User ¶
type User struct { ID int64 `json:"id"` AccountID int64 `json:"account_id"` Mobile string `json:"mobile"` Email string `json:"email"` Name string `json:"name"` Avatar string `json:"avatar"` BackgroundImage string `json:"background_image"` Signature string `json:"signature"` IsDeleted bool `json:"is_deleted"` CreateTime time.Time `json:"create_time"` UpdateTime time.Time `json:"update_time"` }
User is a User model.
type UserRepo ¶
type UserRepo interface { Save(context.Context, *User) error Update(context.Context, *User) error FindByID(context.Context, int64) (*User, error) FindByIDList(context.Context, []int64) ([]*User, error) }
UserRepo is a Greater repo.
type UserUsecase ¶
type UserUsecase struct {
// contains filtered or unexported fields
}
UserUsecase is a User usecase.
func NewUserUsecase ¶
func NewUserUsecase(repo UserRepo, logger log.Logger) *UserUsecase
NewUserUsecase new a User usecase.
func (*UserUsecase) CreateUser ¶
func (uc *UserUsecase) CreateUser(ctx context.Context, g *User) error
CreateUser creates a User, and returns the new User.
func (*UserUsecase) GetUserByIdList ¶
func (*UserUsecase) UpdateUser ¶
func (uc *UserUsecase) UpdateUser(ctx context.Context, g *User) error
UpdateUser updates the User, and returns the updated User.
type Video ¶
type Video struct { ID int64 `json:"id"` // 视频ID UserID int64 `json:"user_id"` // 用户ID Title string `json:"title"` // 标题 Description string `json:"description"` // 描述 VideoURL string `json:"video_url"` // 视频URL CoverURL string `json:"cover_url"` // 封面URL LikeCount int64 `json:"like_count"` // 点赞数 CollectCount int64 `json:"collect_count"` // 收藏数 ForwardCount int64 `json:"forward_count"` // 转发数 CommentCount int64 `json:"comment_count"` // 评论数 IsDeleted bool `json:"is_deleted"` // 是否删除 CreateTime time.Time `json:"create_time"` // 创建时间 UpdateTime time.Time `json:"update_time"` // 更新时间 // Extra Author *User `json:"author"` // 作者信息 IsFavorite int64 `json:"is_favorite"` // 是否点赞 IsCollect int64 `json:"is_collect"` // 是否收藏 }
Video is a Video model.
type VideoRepo ¶
type VideoRepo interface { Save(context.Context, *Video) error Update(context.Context, *Video) error FindByID(context.Context, int64) (*Video, error) FindByIDList(context.Context, []int64) ([]*Video, error) FindByUserID(ctx context.Context, userID int64, lastTime int64, limit int) ([]*Video, error) Find(ctx context.Context, lastID int64, limit int) ([]*Video, error) }
VideoRepo is a Greater repo.
type VideoUsecase ¶
type VideoUsecase struct {
// contains filtered or unexported fields
}
VideoUsecase is a Video usecase.
func NewVideoUsecase ¶
func NewVideoUsecase(repo VideoRepo, userRepo UserRepo, logger log.Logger) *VideoUsecase
NewVideoUsecase new a Video usecase.
func (*VideoUsecase) CreateVideo ¶
func (uc *VideoUsecase) CreateVideo(ctx context.Context, g *Video) error
CreateVideo creates a Video, and returns the new Video.
func (*VideoUsecase) GetVideoByIdList ¶
func (*VideoUsecase) GetVideoByUserID ¶
func (*VideoUsecase) UpdateVideo ¶
func (uc *VideoUsecase) UpdateVideo(ctx context.Context, g *Video) error
UpdateVideo updates the Video, and returns the updated Video.