summaryrefslogtreecommitdiff
path: root/src/post/draft_post.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/post/draft_post.go')
-rw-r--r--src/post/draft_post.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/post/draft_post.go b/src/post/draft_post.go
index 61283c3..0cb2ee1 100644
--- a/src/post/draft_post.go
+++ b/src/post/draft_post.go
@@ -61,7 +61,7 @@ func (s *draftStore) Set(post Post) error {
body=excluded.body`,
post.ID,
post.Title,
- post.Description,
+ &sql.NullString{String: post.Description, Valid: len(post.Description) > 0},
&sql.NullString{String: string(tagsJSON), Valid: len(post.Tags) > 0},
&sql.NullString{String: post.Series, Valid: post.Series != ""},
post.Body,
@@ -112,12 +112,12 @@ func (s *draftStore) get(
for rows.Next() {
var (
- post Post
- tags, series sql.NullString
+ post Post
+ description, tags, series sql.NullString
)
err := rows.Scan(
- &post.ID, &post.Title, &post.Description, &tags, &series,
+ &post.ID, &post.Title, &description, &tags, &series,
&post.Body,
)
@@ -125,6 +125,7 @@ func (s *draftStore) get(
return nil, fmt.Errorf("scanning row: %w", err)
}
+ post.Description = description.String
post.Series = series.String
if tags.String != "" {