1
0
mirror of https://github.com/redis/go-redis.git synced 2025-08-01 16:06:54 +03:00

Marshal time as RFC3339. Add StringCmd.Time helper.

This commit is contained in:
Vladimir Mihailenco
2019-07-25 12:21:12 +03:00
parent 6bc7daa5b1
commit 0e7fb3b12d
5 changed files with 51 additions and 5 deletions

View File

@ -6,6 +6,7 @@ import (
"fmt"
"io"
"strconv"
"time"
"github.com/go-redis/redis/internal/util"
)
@ -92,6 +93,8 @@ func (w *Writer) writeArg(v interface{}) error {
} else {
return w.int(0)
}
case time.Time:
return w.string(v.Format(time.RFC3339))
case encoding.BinaryMarshaler:
b, err := v.MarshalBinary()
if err != nil {