open-bounty/resources/sql/queries.sql

24 lines
575 B
MySQL
Raw Normal View History

-- :name create-user! :! :n
-- :doc creates a new user record
INSERT INTO users
2016-08-22 00:22:39 +00:00
(id, login, name, email, token, address, created)
VALUES (:id, :login, :name, :email, :token, :address, :created);
-- :name update-user! :! :n
-- :doc update an existing user record
UPDATE users
2016-08-22 00:22:39 +00:00
SET login = :login, name = :name, email = :email, token = :token, address = :address
WHERE id = :id;
-- :name update-user-address! :! :n
UPDATE users
SET address = :address
WHERE id = :id;
-- :name get-user :? :1
2016-08-22 00:22:39 +00:00
-- :doc retrieve a user given the login.
SELECT *
FROM users
WHERE login = :login;