Mirror for https://github.com/STBoyden/go-portfolio
at develop 872 B view raw
1-- name: CreatePost :one 2INSERT INTO "posts" (id, slug, content) 3VALUES (gen_random_uuid(), @slug::text, @content::json) 4RETURNING *; 5 6-- name: GetPublishedPosts :many 7SELECT * FROM "posts" WHERE published = TRUE ORDER BY created_at DESC; 8 9-- name: GetPublishedPostBySlug :one 10SELECT * FROM "posts" WHERE published = TRUE AND slug = @slug::text LIMIT 1; 11 12-- name: GetPostByID :one 13SELECT * FROM "posts" WHERE id = @id::uuid LIMIT 1; 14 15-- name: GetPostBySlug :one 16SELECT * FROM "posts" WHERE slug = @slug::text LIMIT 1; 17 18-- name: GetAllPosts :many 19SELECT * FROM "posts" ORDER BY created_at DESC; 20 21-- name: PublishPost :execrows 22UPDATE "posts" SET published = TRUE WHERE id = @id::uuid; 23 24-- name: UnpublishPost :execrows 25UPDATE "posts" SET published = FALSE WHERE id = @id::uuid; 26 27-- name: EditPost :execrows 28UPDATE "posts" 29SET content = @content::json 30WHERE id = @id::uuid;