From f24433040146f9ae829e022ad776eaf136fe70ac Mon Sep 17 00:00:00 2001 From: Untone Date: Sat, 2 Mar 2024 14:40:40 +0300 Subject: [PATCH] type-fix-6 --- server/memorystore/providers/redis/store.go | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/server/memorystore/providers/redis/store.go b/server/memorystore/providers/redis/store.go index db2c72c..acb1fde 100644 --- a/server/memorystore/providers/redis/store.go +++ b/server/memorystore/providers/redis/store.go @@ -238,29 +238,27 @@ func (c *provider) GetUserAppDataFromRedis(userId string) (string, error) { if err != nil { return "", err } - - // Use authorProfileMap["id"] here if necessary - authorId := int(authorProfileMap["id"].(float64)) // convert float64 to int - authorFollowsAuthorsString := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-authors`, authorId)) - authorFollowsTopicsString := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-topics`, authorId)) - authorFollowers := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:followers`, authorId)) - // Combine user data into a JSON string combinedData := "{" - if authorProfileString != nil { + // Use authorProfileMap["id"] here if necessary + authorId, err := int(authorProfileMap["id"].(float64)) // convert float64 to int + if err != nil { combinedData += fmt.Sprintf(`"profile": %s`, authorProfileString) } - if authorFollowsAuthorsString != nil { + authorFollowsAuthorsString, err := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-authors`, authorId)) + if err != nil { combinedData += fmt.Sprintf(`,"authors": %s`, authorFollowsAuthorsString) } - if authorFollowsTopicsString != nil { + authorFollowsTopicsString, err := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:follows-topics`, authorId)) + if err != nil { combinedData += fmt.Sprintf(`,"topics": %s`, authorFollowsTopicsString) } - if authorFollowers != nil { + authorFollowers, err := c.store.Get(c.ctx, fmt.Sprintf(`author:%d:followers`, authorId)) + if err != nil { combinedData += fmt.Sprintf(`,"followers": %s`, authorFollowers) }