1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.26.0
// source: query.sql
package db
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
)
const getUserAuthByUsername = `-- name: GetUserAuthByUsername :one
SELECT users.user_id, username, display_name, icon_path, is_admin, created_at, user_auth_id, user_auths.user_id, auth_type, password_hash FROM users
JOIN user_auths ON users.user_id = user_auths.user_id
WHERE users.username = $1
LIMIT 1
`
type GetUserAuthByUsernameRow struct {
UserID int32
Username string
DisplayName string
IconPath pgtype.Text
IsAdmin bool
CreatedAt pgtype.Timestamp
UserAuthID int32
UserID_2 int32
AuthType string
PasswordHash pgtype.Text
}
func (q *Queries) GetUserAuthByUsername(ctx context.Context, username string) (GetUserAuthByUsernameRow, error) {
row := q.db.QueryRow(ctx, getUserAuthByUsername, username)
var i GetUserAuthByUsernameRow
err := row.Scan(
&i.UserID,
&i.Username,
&i.DisplayName,
&i.IconPath,
&i.IsAdmin,
&i.CreatedAt,
&i.UserAuthID,
&i.UserID_2,
&i.AuthType,
&i.PasswordHash,
)
return i, err
}
const getUserById = `-- name: GetUserById :one
SELECT user_id, username, display_name, icon_path, is_admin, created_at FROM users
WHERE users.user_id = $1
LIMIT 1
`
func (q *Queries) GetUserById(ctx context.Context, userID int32) (User, error) {
row := q.db.QueryRow(ctx, getUserById, userID)
var i User
err := row.Scan(
&i.UserID,
&i.Username,
&i.DisplayName,
&i.IconPath,
&i.IsAdmin,
&i.CreatedAt,
)
return i, err
}
|