23 lines
478 B
SQL
23 lines
478 B
SQL
-- name: CreateFeed :one
|
|
INSERT INTO feeds (created_at, updated_at, name, url, user_id)
|
|
VALUES (?, ?, ?, ?, ?)
|
|
RETURNING *;
|
|
|
|
-- name: GetFeedsByUser :many
|
|
SELECT * FROM feeds WHERE user_id = ?;
|
|
|
|
-- name: GetFeeds :many
|
|
SELECT * FROM feeds;
|
|
|
|
-- name: GetNextFeedToFetch :many
|
|
SELECT * FROM feeds
|
|
ORDER BY last_fetched_at ASC NULLS FIRST
|
|
LIMIT ?;
|
|
|
|
-- name: MarkFeedAsFetched :one
|
|
UPDATE feeds
|
|
SET last_fetched_at = date('nowj'),
|
|
updated_at = date('now')
|
|
WHERE id = ?
|
|
RETURNING *;
|