repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
184a78b
parent
cef62bf
author
Eric Bower
date
2023-02-28 05:12:14 +0000 UTC
chore(db): add view count to post struct
1 files changed,  +3, -1
M db/postgres/storage.go
+3, -1
 1@@ -20,7 +20,7 @@ var PAGER_SIZE = 15
 2 
 3 var SelectPost = `
 4 	posts.id, user_id, app_users.name, filename, slug, title, text, description,
 5-	posts.created_at, publish_at, posts.updated_at, hidden, file_size, mime_type, shasum, data, expires_at`
 6+	posts.created_at, publish_at, posts.updated_at, hidden, file_size, mime_type, shasum, data, expires_at, views`
 7 
 8 var (
 9 	sqlSelectPosts = fmt.Sprintf(`
10@@ -268,6 +268,7 @@ func CreatePostFromRow(r RowScanner) (*db.Post, error) {
11 		&post.Shasum,
12 		&post.Data,
13 		&post.ExpiresAt,
14+		&post.Views,
15 	)
16 	if err != nil {
17 		return nil, err
18@@ -296,6 +297,7 @@ func CreatePostWithTagsFromRow(r RowScanner) (*db.Post, error) {
19 		&post.Shasum,
20 		&post.Data,
21 		&post.ExpiresAt,
22+		&post.Views,
23 		&tagStr,
24 	)
25 	if err != nil {