replace all single-row SelectContext calls with GetContext calls

This commit is contained in:
2026-02-23 16:31:08 -07:00
parent 5bd6f3b906
commit 4113ba2fca
9 changed files with 113 additions and 227 deletions
+3 -7
View File
@@ -12,7 +12,6 @@ package database
import (
"context"
"database/sql"
"errors"
"sync"
"git.erbosoft.com/amy/amsterdam/util"
@@ -108,15 +107,12 @@ func AmGlobals(ctx context.Context) (*Globals, error) {
globalsMutex.Lock()
defer globalsMutex.Unlock()
if theGlobals == nil {
var dbdata []Globals
err := amdb.SelectContext(ctx, &dbdata, "SELECT * FROM globals")
var g Globals
err := amdb.GetContext(ctx, &g, "SELECT * FROM globals")
if err != nil {
return nil, err
}
if len(dbdata) > 1 {
return nil, errors.New("should only be one globals record")
}
theGlobals = &(dbdata[0])
theGlobals = &g
}
return theGlobals, nil
}