Skip to content

How to check if queried record doesn't exist? #6084

Answered by acynothia
intervinn asked this question in Q&A
Discussion options

You must be logged in to vote
if err := if lib.DB.First(&models.User{Email: payload.Email}).Error; errors.Is(err, gorm.ErrRecordNotFound) {

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@phantomdenkali
Comment options

@phantomdenkali
Comment options

Answer selected by intervinn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants