diff --git a/README.md b/README.md index 8c6e2302..6ff49b87 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,11 @@ The fantastic ORM library for Golang, aims to be developer friendly. ## Getting Started -* GORM Guides [jinzhu.github.com/gorm](http://jinzhu.github.io/gorm) +* GORM Guides [jinzhu.github.com/gorm](https://jinzhu.github.io/gorm) ## Upgrading To V1.0 -* [CHANGELOG](http://jinzhu.github.io/gorm/changelog.html) +* [CHANGELOG](https://jinzhu.github.io/gorm/changelog.html) ## Supporting the project diff --git a/errors.go b/errors.go index 6845188e..da2cf13c 100644 --- a/errors.go +++ b/errors.go @@ -21,6 +21,18 @@ var ( // Errors contains all happened errors type Errors []error +// IsRecordNotFoundError returns current error has record not found error or not +func IsRecordNotFoundError(err error) bool { + if errs, ok := err.(Errors); ok { + for _, err := range errs { + if err == ErrRecordNotFound { + return true + } + } + } + return err == ErrRecordNotFound +} + // GetErrors gets all happened errors func (errs Errors) GetErrors() []error { return errs