summaryrefslogtreecommitdiff
path: root/src/post/post.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/post/post.go')
-rw-r--r--src/post/post.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/post/post.go b/src/post/post.go
index 03bce6c..1bdf03e 100644
--- a/src/post/post.go
+++ b/src/post/post.go
@@ -115,7 +115,7 @@ func (s *store) Set(post Post, now time.Time) (bool, error) {
body=excluded.body`,
post.ID,
post.Title,
- post.Description,
+ &sql.NullString{String: post.Description, Valid: len(post.Description) > 0},
&sql.NullString{String: post.Series, Valid: post.Series != ""},
nowSQL,
post.Body,
@@ -202,12 +202,12 @@ func (s *store) get(
var (
post StoredPost
- series, tag sql.NullString
+ description, tag, series sql.NullString
publishedAt, lastUpdatedAt sql.NullInt64
)
err := rows.Scan(
- &post.ID, &post.Title, &post.Description, &series, &tag,
+ &post.ID, &post.Title, &description, &series, &tag,
&publishedAt, &lastUpdatedAt,
&post.Body,
)
@@ -216,6 +216,7 @@ func (s *store) get(
return nil, fmt.Errorf("scanning row: %w", err)
}
+ post.Description = description.String
post.Series = series.String
if tag.String != "" {