query.sql 303 B

12345678910111213141516171819
  1. -- name: GetAuthor :one
  2. SELECT * FROM authors
  3. WHERE id = $1 LIMIT 1;
  4. -- name: ListAuthors :many
  5. SELECT * FROM authors
  6. ORDER BY name;
  7. -- name: CreateAuthor :one
  8. INSERT INTO authors (
  9. name, bio
  10. ) VALUES (
  11. $1, $2
  12. )
  13. RETURNING *;
  14. -- name: DeleteAuthor :exec
  15. DELETE FROM authors
  16. WHERE id = $1;