diff options
Diffstat (limited to 'src/user/user.go')
| -rw-r--r-- | src/user/user.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/user/user.go b/src/user/user.go index e35c7c5..d9fca6b 100644 --- a/src/user/user.go +++ b/src/user/user.go @@ -6,7 +6,6 @@ import ( "fmt" "time" - "github.com/jackc/pgx/v5" "gitlab.com/alexkavon/newsstand/src/db" "golang.org/x/crypto/argon2" ) @@ -23,11 +22,17 @@ type User struct { Db *db.Database } +func NewUser(d *db.Database) *User { + return &User{ + Db: d, + } +} + func (u *User) Insert() error { err := u.Db.InsertTable( "users", []string{"username", "secret", "email"}, - pgx.NamedArgs{"username": u.Username, "secret": string(u.hash), "email": u.Email}, + db.DbValues{"username": u.Username, "secret": string(u.hash), "email": u.Email}, ) if err != nil { return err |
