diff options
Diffstat (limited to 'srv/src/post/post.go')
-rw-r--r-- | srv/src/post/post.go | 5 |
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() |