Skip to content

Commit

Permalink
Add sql posts
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyyy09 committed Aug 3, 2023
1 parent 1ccdf33 commit 6448e97
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 0 additions & 2 deletions scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (
"strings"
"sync"
"time"

"github.com/bootdotdev/projects/posts/internal/database"
"github.com/google/uuid"
)

Expand Down
14 changes: 11 additions & 3 deletions sql/queries/posts.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
-- name: CreatePost :one

INSERT INTO users (id, created_at, updated_at, title, url, feed_id,published_at,description)
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 *;
RETURNING *;
--

-- name: GetPostsForUser :many
SELECT posts.* FROM posts
JOIN feed_follows ON feed_follows.feed_id = posts.feed_id
WHERE feed_follows.user_id = $1
ORDER BY posts.published_at DESC
LIMIT $2;
--

0 comments on commit 6448e97

Please sign in to comment.