Skip to content

Iter25#27

Open
MWT-proger wants to merge 7 commits intomainfrom
iter25
Open

Iter25#27
MWT-proger wants to merge 7 commits intomainfrom
iter25

Conversation

@MWT-proger
Copy link
Copy Markdown
Owner

No description provided.

}

ip, err := resolveIP(r)
fmt.Println(ip)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вот это хорошо бы убрать

if !ok {
return nil, status.Error(codes.Internal, "")
}
fmt.Println(userID, in.ShortKeys)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

И тут, прокинь просто логер и используй его везде

}

// jsonShortenResponse - тело ответа для GetStats.
type jsonStatsResponse struct {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше в /models како-нибудь

urls, users, err = s.storage.CountUsersAndUrls(ctx)

if err != nil {
return 0, 0, lErrors.InternalServicesError
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А если у пользователя 0 ссылок? Протухли например, в таких ситуациях лучше кмк использовать указатели, потому что формально 0 вполне валидное значение

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если будут нули , то ошибки не будет

}

// CountUsersAndUrls возвращает количество пользователей и сокращенных URL в сервисе.
func (s fileStorage) CountUsersAndUrls(ctx context.Context) (urls int, users int, err error) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А зачем такая функция?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants