mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: split queries.sql into files by table (#762)
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
-- name: GetUserByID :one
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
users
|
||||
WHERE
|
||||
id = $1
|
||||
LIMIT
|
||||
1;
|
||||
|
||||
-- name: GetUserByEmailOrUsername :one
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
users
|
||||
WHERE
|
||||
LOWER(username) = LOWER(@username)
|
||||
OR email = @email
|
||||
LIMIT
|
||||
1;
|
||||
|
||||
-- name: GetUserCount :one
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
users;
|
||||
|
||||
-- name: InsertUser :one
|
||||
INSERT INTO
|
||||
users (
|
||||
id,
|
||||
email,
|
||||
"name",
|
||||
login_type,
|
||||
revoked,
|
||||
hashed_password,
|
||||
created_at,
|
||||
updated_at,
|
||||
username
|
||||
)
|
||||
VALUES
|
||||
($1, $2, $3, $4, FALSE, $5, $6, $7, $8) RETURNING *;
|
||||
Reference in New Issue
Block a user