diff options
Diffstat (limited to 'src/post/draft_post.go')
-rw-r--r-- | src/post/draft_post.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/post/draft_post.go b/src/post/draft_post.go index 0cb2ee1..1c0e075 100644 --- a/src/post/draft_post.go +++ b/src/post/draft_post.go @@ -49,22 +49,24 @@ func (s *draftStore) Set(post Post) error { _, err = s.db.db.Exec( `INSERT INTO post_drafts ( - id, title, description, tags, series, body + id, title, description, tags, series, body, format ) VALUES - (?, ?, ?, ?, ?, ?) + (?, ?, ?, ?, ?, ?, ?) ON CONFLICT (id) DO UPDATE SET title=excluded.title, description=excluded.description, tags=excluded.tags, series=excluded.series, - body=excluded.body`, + body=excluded.body, + format=excluded.format`, post.ID, post.Title, &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, + post.Format, ) if err != nil { @@ -86,7 +88,7 @@ func (s *draftStore) get( query := ` SELECT - p.id, p.title, p.description, p.tags, p.series, p.body + p.id, p.title, p.description, p.tags, p.series, p.body, p.format FROM post_drafts p ` + where + ` ORDER BY p.id ASC` @@ -118,7 +120,7 @@ func (s *draftStore) get( err := rows.Scan( &post.ID, &post.Title, &description, &tags, &series, - &post.Body, + &post.Body, &post.Format, ) if err != nil { |