This commit is contained in:
oneao committed 2026-01-25 22:18:27 +08:00
1 parent 500fab7a80
commit 8f3f6982db
54 files changed
+2076 -1877

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
-- name: FindUserByOpenID :one
SELECT
u.id AS user_id,
u.username,
u.avatar,
u.status,
o.type AS login_type,
o.openid
FROM user_oauth o
JOIN "user" u ON u.id = o.user_id
WHERE o.openid = $1
AND o.type = $2
LIMIT 1;
-- name: InsertUser :exec
INSERT INTO "user" (
id,
username,
avatar,
status,
create_time,
update_time,
last_login_time
) VALUES (
$1, $2, $3,$4, NOW(), NOW(),now()
)
RETURNING id;
-- name: UpdateUserLastLoginTime :exec
UPDATE "user"
SET last_login_time = NOW()
WHERE id = $1;