Add database query status (and improved response), photos, likes, comments, bans

This commit is contained in:
Marco Realacci 2022-11-20 19:21:26 +01:00
parent 519ae22197
commit abbd5bc494
22 changed files with 1118 additions and 72 deletions

View file

@ -9,3 +9,17 @@ func EmptySet(err error) bool {
}
return strings.Contains(err.Error(), "no rows in result set")
}
func UniqueViolation(err error) bool {
if err == nil {
return false
}
return strings.Contains(err.Error(), "UNIQUE constraint failed")
}
func ForeignKeyViolation(err error) bool {
if err == nil {
return false
}
return strings.Contains(err.Error(), "FOREIGN KEY constraint failed")
}