fix some security issues

This commit is contained in:
wagslane
2023-06-06 13:33:22 -06:00
parent 307c73e1fb
commit 54f294659f
5 changed files with 10 additions and 7 deletions

View File

@@ -40,13 +40,13 @@ func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) error {
return err
}
const getUserByAPIKey = `-- name: GetUserByAPIKey :one
const getUser = `-- name: GetUser :one
SELECT id, created_at, updated_at, name, api_key FROM users WHERE api_key = ?
`
func (q *Queries) GetUserByAPIKey(ctx context.Context, apiKey string) (User, error) {
row := q.db.QueryRowContext(ctx, getUserByAPIKey, apiKey)
func (q *Queries) GetUser(ctx context.Context, apiKey string) (User, error) {
row := q.db.QueryRowContext(ctx, getUser, apiKey)
var i User
err := row.Scan(
&i.ID,