mirror of
https://github.com/notherealmarco/WASAPhoto.git
synced 2025-05-05 12:22:35 +02:00
Improve comments and code readability
This commit is contained in:
parent
f6ad6db2f7
commit
3de158e5a5
19 changed files with 84 additions and 43 deletions
|
@ -2,7 +2,7 @@ package db_errors
|
|||
|
||||
import "strings"
|
||||
|
||||
// Returns true if the query result has no rows
|
||||
// Returns true if the error is a "no rows in result set" error
|
||||
func EmptySet(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
|
@ -10,6 +10,7 @@ func EmptySet(err error) bool {
|
|||
return strings.Contains(err.Error(), "no rows in result set")
|
||||
}
|
||||
|
||||
// Returns true if the error is a Unique constraint violation error
|
||||
func UniqueViolation(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
|
@ -17,6 +18,7 @@ func UniqueViolation(err error) bool {
|
|||
return strings.Contains(err.Error(), "UNIQUE constraint failed")
|
||||
}
|
||||
|
||||
// Returns true if the error is a Foreign Key constraint violation error
|
||||
func ForeignKeyViolation(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue