2016-08-20 21:36:09 +00:00
|
|
|
-- :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);
|
2016-08-20 21:36:09 +00:00
|
|
|
|
|
|
|
-- :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;
|
2016-08-20 21:36:09 +00:00
|
|
|
|
|
|
|
-- :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;
|
2016-08-20 21:36:09 +00:00
|
|
|
|