summaryrefslogtreecommitdiff
path: root/model/users.sql.go
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2024-10-17 21:58:02 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2024-10-17 21:58:02 +0200
commit88fa53fb9e2f45f47b33d5edef43e7338d5c4f03 (patch)
tree736a07623feb6b07a045d053ca1e296c0207b5fb /model/users.sql.go
parentbdce74729c3529d7b5b1465bd23a079a3ec0caab (diff)
downloadgosten-88fa53fb9e2f45f47b33d5edef43e7338d5c4f03.tar.gz
gosten-88fa53fb9e2f45f47b33d5edef43e7338d5c4f03.tar.bz2
gosten-88fa53fb9e2f45f47b33d5edef43e7338d5c4f03.zip
Introduce change password functionality
Diffstat (limited to 'model/users.sql.go')
-rw-r--r--model/users.sql.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/model/users.sql.go b/model/users.sql.go
index e63dacc..bd881b7 100644
--- a/model/users.sql.go
+++ b/model/users.sql.go
@@ -9,6 +9,24 @@ import (
"context"
)
+const getPwdById = `-- name: GetPwdById :one
+ SELECT pwd
+ FROM users
+ WHERE id = $1
+`
+
+// GetPwdById
+//
+// SELECT pwd
+// FROM users
+// WHERE id = $1
+func (q *Queries) GetPwdById(ctx context.Context, id int32) (string, error) {
+ row := q.db.QueryRow(ctx, getPwdById, id)
+ var pwd string
+ err := row.Scan(&pwd)
+ return pwd, err
+}
+
const getUserById = `-- name: GetUserById :one
SELECT id, name, pwd, description
FROM users
@@ -88,3 +106,24 @@ func (q *Queries) GetUsers(ctx context.Context) ([]User, error) {
}
return items, nil
}
+
+const updatePwd = `-- name: UpdatePwd :exec
+ UPDATE users
+ SET pwd = $1
+ WHERE id = $2
+`
+
+type UpdatePwdParams struct {
+ Pwd string
+ ID int32
+}
+
+// UpdatePwd
+//
+// UPDATE users
+// SET pwd = $1
+// WHERE id = $2
+func (q *Queries) UpdatePwd(ctx context.Context, arg UpdatePwdParams) error {
+ _, err := q.db.Exec(ctx, updatePwd, arg.Pwd, arg.ID)
+ return err
+}