Skip to content

Commit c30891c

Browse files
committed
fix: 修复filter.Time方法的接收器,不能使用指针接收,会在序列化时候无法正确序列化
1 parent ffd6060 commit c30891c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

filter/time.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ type Time time.Time
99

1010
var timeFmt = "2006-01-02 15:04:05"
1111

12-
func (t *Time) MarshalJSON() ([]byte, error) {
13-
fmtTime := time.Time(*t)
12+
func (t Time) MarshalJSON() ([]byte, error) {
13+
fmtTime := time.Time(t)
1414
formatted := fmt.Sprintf("\"%s\"", fmtTime.Format(timeFmt))
1515
return []byte(formatted), nil
1616
}
@@ -26,6 +26,6 @@ func (t *Time) UnmarshalJSON(data []byte) error {
2626
return err
2727
}
2828

29-
func (t *Time) String() string {
30-
return time.Time(*t).Format(timeFmt)
29+
func (t Time) String() string {
30+
return time.Time(t).Format(timeFmt)
3131
}

0 commit comments

Comments
 (0)