grpcexercises/consuldemo/pkg/db/query.sql

15 lines
460 B
MySQL
Raw Normal View History

2023-12-17 15:48:47 +08:00
-- name: CreateUser :execresult
INSERT INTO grpcstudy.user (username, mobile, email, password) VALUES (?, ?, ?, ?);
-- name: GetUserById :one
SELECT * FROM grpcstudy.user WHERE id = ? LIMIT 1;
-- name: GetUserByUsername :one
SELECT * FROM grpcstudy.user WHERE username = ? LIMIT 1;
-- name: GetUserByMobile :one
SELECT * FROM grpcstudy.user WHERE mobile = ? LIMIT 1;
-- name: ListUsers :many
SELECT * FROM grpcstudy.user ORDER BY id DESC LIMIT ? OFFSET ?;