use servemux *properly* this time; better error handling for DB gets

This commit is contained in:
ari melody 2025-11-08 15:04:07 +00:00
parent a33e6717e0
commit b7c1d85830
Signed by: ari
GPG key ID: CF99829C92678188
16 changed files with 234 additions and 288 deletions

View file

@ -1,9 +1,10 @@
package controller
import (
"arimelody-web/model"
"arimelody-web/model"
"strings"
"github.com/jmoiron/sqlx"
"github.com/jmoiron/sqlx"
)
// DATABASE
@ -13,6 +14,7 @@ func GetArtist(db *sqlx.DB, id string) (*model.Artist, error) {
err := db.Get(&artist, "SELECT * FROM artist WHERE id=$1", id)
if err != nil {
if strings.Contains(err.Error(), "no rows") { return nil, nil }
return nil, err
}