summaryrefslogtreecommitdiff
path: root/srv/src/post
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2022-05-20 10:47:22 -0600
committerBrian Picciano <mediocregopher@gmail.com>2022-05-20 10:47:22 -0600
commit2c4b617ddeb71a5856075c94dcc7dfff3cfcbcaa (patch)
tree66ea2c37d91e51c7b426d13db0203e5851c66bfc /srv/src/post
parent75044eef0331bb9448da813288aafc6735ce7c22 (diff)
Implement saving of new and edited posts
Diffstat (limited to 'srv/src/post')
-rw-r--r--srv/src/post/post.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/srv/src/post/post.go b/srv/src/post/post.go
index 766a543..803356e 100644
--- a/srv/src/post/post.go
+++ b/srv/src/post/post.go
@@ -124,6 +124,11 @@ func (s *store) withTx(cb func(*sql.Tx) error) error {
}
func (s *store) Set(post Post, now time.Time) error {
+
+ if post.ID == "" {
+ return errors.New("post ID can't be empty")
+ }
+
return s.withTx(func(tx *sql.Tx) error {
nowTS := now.Unix()