提交 1fa3ac55 编写于 作者: A Asim Aslam

write nil when expiry is zero

上级 375b67ee
......@@ -429,7 +429,14 @@ func (s *sqlStore) Write(r *store.Record, opts ...store.WriteOption) error {
} else if r.Expiry != 0 {
expiry = time.Now().Add(r.Expiry)
}
if _, err := st.Exec(r.Key, r.Value, metadata, expiry); err != nil {
if expiry.IsZero() {
_, err = st.Exec(r.Key, r.Value, metadata, nil)
} else {
_, err = st.Exec(r.Key, r.Value, metadata, expiry)
}
if err != nil {
return errors.Wrap(err, "Couldn't insert record "+r.Key)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册