naise_pos/db/query/users.sql

24 lines
407 B
MySQL
Raw Permalink Normal View History

2023-03-12 11:01:43 +07:00
-- name: CreateUser :one
INSERT INTO users (
email,
password,
fullname
) VALUES ($1, $2, $3)
RETURNING *;
-- name: GetPasswordByEmail :one
SELECT password
FROM users
2023-03-13 09:24:59 +07:00
WHERE email = $1;
2023-03-12 11:01:43 +07:00
-- name: GetUserById :one
2023-03-19 18:17:17 +07:00
SELECT *
FROM users u
JOIN merchants m on u.id = m.owner_id
WHERE u.id = $1;
2023-03-14 17:39:40 +07:00
-- name: GetUserByEmail :one
SELECT *
2023-03-19 18:17:17 +07:00
FROM users u
JOIN merchants m on u.id = m.owner_id
WHERE email = $1;