11 lines
465 B
SQL
11 lines
465 B
SQL
-- name: CreateUser :one
|
|
INSERT INTO users (twitter_id, username, name, access_token, refresh_token, created_at, updated_at)
|
|
VALUES ($1, $2, $3, $4, $5, $6, $7)
|
|
ON CONFLICT (twitter_id)
|
|
DO
|
|
UPDATE SET access_token = EXCLUDED.access_token, refresh_token = EXCLUDED.refresh_token, username = EXCLUDED.username, name = EXCLUDED.name, updated_at = EXCLUDED.updated_at
|
|
RETURNING *;
|
|
|
|
-- name: GetUserByTwitterID :one
|
|
SELECT * FROM users WHERE twitter_id = $1;
|