From a632768ef899ba1dbbb4bd2c3e2ddccb7403d0cf Mon Sep 17 00:00:00 2001 From: Leon <147289645+LeoninCS@users.noreply.github.com> Date: Tue, 23 Dec 2025 02:23:42 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=8A=A0=E5=85=A5=E4=BA=86mysql?= =?UTF-8?q?=E7=9A=84=E4=B8=80=E4=BA=9B=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/feed/entity.go | 13 ++++++++++--- internal/social/entity.go | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/internal/feed/entity.go b/internal/feed/entity.go index 43d0730..a5abe4b 100644 --- a/internal/feed/entity.go +++ b/internal/feed/entity.go @@ -29,13 +29,20 @@ type ListLatestResponse struct { } type ListLikesCountRequest struct { - Limit int `json:"limit"` - LikesCount int64 `json:"likes_count"` + Limit int `json:"limit"` + LikesCountBefore *int64 `json:"likes_count_before,omitempty"` + IDBefore *uint `json:"id_before,omitempty"` +} + +type LikesCountCursor struct { + LikesCount int64 + ID uint } type ListLikesCountResponse struct { VideoList []FeedVideoItem `json:"video_list"` - NextLikesCountBefore int64 `json:"next_likes_count_before"` + NextLikesCountBefore *int64 `json:"next_likes_count_before,omitempty"` + NextIDBefore *uint `json:"next_id_before,omitempty"` HasMore bool `json:"has_more"` } diff --git a/internal/social/entity.go b/internal/social/entity.go index 6fc5842..17d9e9b 100644 --- a/internal/social/entity.go +++ b/internal/social/entity.go @@ -4,8 +4,8 @@ import "feedsystem_video_go/internal/account" type Social struct { ID uint `gorm:"primaryKey"` - FollowerID uint `gorm:"index"` - VloggerID uint `gorm:"index"` + FollowerID uint `gorm:"not null;index:idx_social_follower;uniqueIndex:idx_social_follower_vlogger"` + VloggerID uint `gorm:"not null;index:idx_social_vlogger;uniqueIndex:idx_social_follower_vlogger"` } type FollowRequest struct {