First pass of authentication
This commit is contained in:
parent
c943864edc
commit
01c6e9de87
15 changed files with 311 additions and 42 deletions
|
|
@ -25,8 +25,19 @@ func (q *Queries) InsertUser(ctx context.Context, arg InsertUserParams) (int64,
|
|||
return id, err
|
||||
}
|
||||
|
||||
const selectUserByID = `-- name: SelectUserByID :one
|
||||
SELECT id, username, password FROM users WHERE id = ? LIMIT 1
|
||||
`
|
||||
|
||||
func (q *Queries) SelectUserByID(ctx context.Context, id int64) (User, error) {
|
||||
row := q.db.QueryRowContext(ctx, selectUserByID, id)
|
||||
var i User
|
||||
err := row.Scan(&i.ID, &i.Username, &i.Password)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const selectUserByUsername = `-- name: SelectUserByUsername :one
|
||||
SELECT id, username, password FROM users WHERE username = ?
|
||||
SELECT id, username, password FROM users WHERE username = ? LIMIT 1
|
||||
`
|
||||
|
||||
func (q *Queries) SelectUserByUsername(ctx context.Context, username string) (User, error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue