-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
var socialAccount social.SocialAccount
err := app.Database().Get(&socialAccount, `SELECT * FROM social_account WHERE username=$1 AND platform=$2 AND deleted_at IS NULL`, request.Validated.Username, request.Validated.Platform)
if err != nil && !errors.Is(err, sql.ErrNoRows) {
return response.Error(err, response.WithMessage("Failed to check existing social account"))
}
It's not possible to make socialAccount *social.SocialAccount as sqlx doesn't accept that. But now the struct is always initialized even when there are no results. I need to check whether the social account exists, but there is no way to do this?
if socialAccount != nil {
}
Now I have to do something like:
if socialAccount.ID != "" {
}
Metadata
Metadata
Assignees
Labels
No labels