22 lines
396 B
SQL
22 lines
396 B
SQL
-- name: CreatePost :one
|
|
INSERT INTO posts (
|
|
created_at,
|
|
updated_at,
|
|
title,
|
|
description,
|
|
published_at,
|
|
url,
|
|
feed_id)
|
|
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
RETURNING *;
|
|
|
|
-- name: GetPosts :many
|
|
SELECT * FROM posts;
|
|
|
|
-- name: GetPostsForUser :many
|
|
SELECT posts.* FROM posts
|
|
JOIN feed_follows ON posts.feed_id = feed_follows.id
|
|
WHERE feed_follows.user_id = ?
|
|
ORDER BY posts.published_at DESC
|
|
LIMIT ?;
|