updated to use bun and updated hws modules.

This commit is contained in:
2026-01-11 23:39:10 +11:00
parent 6e03c98ae8
commit 1eedbc5220
33 changed files with 984 additions and 375 deletions

View File

@@ -4,6 +4,7 @@ import (
"database/sql"
"fmt"
"git.haelnorr.com/h/golib/hwsauth"
"github.com/pkg/errors"
)
@@ -31,7 +32,9 @@ func CreateNewUser(
// Fetches data from the users table using "WHERE column = 'value'"
func fetchUserData(
tx *sql.Tx,
tx interface {
Query(query string, args ...any) (*sql.Rows, error)
},
column string,
value any,
) (*sql.Rows, error) {
@@ -87,7 +90,7 @@ func GetUserFromUsername(tx *sql.Tx, username string) (*User, error) {
}
// Queries the database for a user matching the given ID.
func GetUserFromID(tx *sql.Tx, id int) (*User, error) {
func GetUserFromID(tx hwsauth.DBTransaction, id int) (*User, error) {
rows, err := fetchUserData(tx, "id", id)
if err != nil {
return nil, errors.Wrap(err, "fetchUserData")