fix: Capitalize struct fields for public access
All checks were successful
Gitea Build Check / Build (push) Successful in 1m2s

This commit is contained in:
SoXX 2024-10-25 22:46:22 +02:00
parent 41882b9bfb
commit 107a317095

View File

@ -10,15 +10,15 @@ import (
) )
type User struct { type User struct {
userFavoriteCount int64 UserFavoriteCount int64
userName string UserName string
userID string UserID string
} }
type Favorites struct { type Favorites struct {
posts []models.Post Posts []models.Post
nextPage string NextPage string
lastPage string LastPage string
} }
type Plug interface { type Plug interface {
@ -70,7 +70,7 @@ func Algorithm(ctx context.Context, plugInterface Plug, db *gorm.DB, userSource
nextPage := "" nextPage := ""
outer: outer:
for anthroveUserFavCount < profile.userFavoriteCount { for anthroveUserFavCount < profile.UserFavoriteCount {
select { select {
case <-ctx.Done(): case <-ctx.Done():
break outer break outer
@ -87,13 +87,13 @@ outer:
return taskSummery, err return taskSummery, err
} }
if len(favorites.posts) <= 0 { if len(favorites.Posts) <= 0 {
span.AddEvent("No more favorites found") span.AddEvent("No more favorites found")
log.WithContext(ctx).WithFields(basicLoggingInfo).Info("No more favorites found") log.WithContext(ctx).WithFields(basicLoggingInfo).Info("No more favorites found")
break outer break outer
} }
summery, err := BatchPostProcessingWithSummery(ctx, userSource, favorites.posts) summery, err := BatchPostProcessingWithSummery(ctx, userSource, favorites.Posts)
if err != nil { if err != nil {
span.RecordError(err) span.RecordError(err)
span.SetStatus(codes.Error, err.Error()) span.SetStatus(codes.Error, err.Error())
@ -101,12 +101,12 @@ outer:
return taskSummery, err return taskSummery, err
} }
if summery.AddedFavorites != int64(len(favorites.posts)) { if summery.AddedFavorites != int64(len(favorites.Posts)) {
span.AddEvent("user has no more favorites to add") span.AddEvent("user has no more favorites to add")
break outer break outer
} }
nextPage = favorites.nextPage nextPage = favorites.NextPage
taskSummery.AddedPosts += int(summery.AddedFavorites) taskSummery.AddedPosts += int(summery.AddedFavorites)
} }
} }