generated from templates/go-generic
33 lines
420 B
SQL
33 lines
420 B
SQL
-- 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;
|