Skip to content

Commit ea0dee9

Browse files
committed
refactor: Optimize String method of TimestampType
1 parent e481ee5 commit ea0dee9

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

type_timestamp.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,7 @@ func (t *TimestampType[T]) UnmarshalJSON(src []byte) error {
159159
// String implements Stringer interface for TimestampType generic struct.
160160
// 实现 Stringer 接口
161161
func (t *TimestampType[T]) String() string {
162-
if t == nil {
163-
return "0"
164-
}
165-
if t.IsInvalid() || t.IsZero() {
162+
if t == nil || t.IsInvalid() || t.IsZero() {
166163
return "0"
167164
}
168165
return strconv.FormatInt(t.Int64(), 10)

0 commit comments

Comments
 (0)