gator/sql/postgres/queries/posts.sql

34 lines
420 B
MySQL
Raw Permalink Normal View History

2024-10-01 01:12:12 +01:00
-- name: CreatePost :one
INSERT INTO posts (
id,
created_at,
updated_at,
title,
url,
description,
published_at,
feed_id
)
VALUES (
$1,
$2,
$3,
$4,
$5,
$6,
$7,
$8
)
RETURNING *;
-- name: GetPostsForUser :many
SELECT title, url, published_at
FROM posts
WHERE feed_id IN (
SELECT feed_id
FROM feed_follows
WHERE user_id = $1
)
ORDER BY published_at DESC
LIMIT $2;