updated to use bun and updated hws modules.
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user