some database code cleanups

This commit is contained in:
2026-03-05 15:47:23 -07:00
parent 1f450dcf14
commit 55c5c88c95
13 changed files with 137 additions and 137 deletions
+4 -4
View File
@@ -64,13 +64,13 @@ func AmGetAd(ctx context.Context, adid int32) (*Advert, error) {
if ok {
return rc.(*Advert), nil
}
var theAd Advert
err := amdb.GetContext(ctx, &theAd, "SELECT * FROM adverts WHERE adid = ?", adid)
theAd := new(Advert)
err := amdb.GetContext(ctx, theAd, "SELECT * FROM adverts WHERE adid = ?", adid)
if err != nil {
return nil, err
}
adCache.Add(adid, &theAd)
return &theAd, nil
adCache.Add(adid, theAd)
return theAd, nil
}
// AmGetRandomAd gets a random ad from the