对接
This commit is contained in:
@@ -53,6 +53,7 @@ type Repo interface {
|
||||
ListRecent(context.Context, uint, int) ([]*Message, error)
|
||||
CreateChat(context.Context, uint, uint, string) (*Message, error)
|
||||
CreateGift(context.Context, *GiftSnapshot) (*Message, error)
|
||||
Clear(context.Context, uint) error
|
||||
}
|
||||
|
||||
type Usecase struct{ repo Repo }
|
||||
@@ -83,3 +84,10 @@ func (uc *Usecase) RecordGift(ctx context.Context, gift *GiftSnapshot) (*Message
|
||||
}
|
||||
return uc.repo.CreateGift(ctx, gift)
|
||||
}
|
||||
|
||||
func (uc *Usecase) Clear(ctx context.Context, roomID uint) error {
|
||||
if roomID == 0 {
|
||||
return ErrRoomNotFound
|
||||
}
|
||||
return uc.repo.Clear(ctx, roomID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user