Merge branch 'auth' into dev
This commit is contained in:
commit
497e4039ec
1 changed files with 23 additions and 0 deletions
|
|
@ -281,6 +281,29 @@ func (q *Queries) GetUserByID(ctx context.Context, id int64) (GetUserByIDRow, er
|
|||
return i, err
|
||||
}
|
||||
|
||||
const getUserByNickname = `-- name: GetUserByNickname :one
|
||||
SELECT id, avatar_id, passhash, mail, nickname, disp_name, user_desc, creation_date, last_login
|
||||
FROM users
|
||||
WHERE nickname = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetUserByNickname(ctx context.Context, nickname string) (User, error) {
|
||||
row := q.db.QueryRow(ctx, getUserByNickname, nickname)
|
||||
var i User
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.AvatarID,
|
||||
&i.Passhash,
|
||||
&i.Mail,
|
||||
&i.Nickname,
|
||||
&i.DispName,
|
||||
&i.UserDesc,
|
||||
&i.CreationDate,
|
||||
&i.LastLogin,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getUserTitleByID = `-- name: GetUserTitleByID :one
|
||||
SELECT
|
||||
ut.user_id, ut.title_id, ut.status, ut.rate, ut.review_id, ut.ctime,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue