Skip to content

Commit a19e3f2

Browse files
committed
Merge branch 'master' of https://github.com/gohouse/gorose
2 parents a2cec17 + 122d493 commit a19e3f2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

utils/util.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"reflect"
77
"strconv"
88
"strings"
9+
"time"
910
)
1011

1112
// GetType : 获取数据类型字符串 (string, int, float64, []int, []string, map[string]int ...)
@@ -63,12 +64,20 @@ func ParseStr(data interface{}) string {
6364
return strconv.Itoa(data.(int))
6465
case int64:
6566
return strconv.FormatInt(data.(int64), 10)
67+
case int32:
68+
return strconv.FormatInt(int64(data.(int32)), 10)
69+
case uint32:
70+
return strconv.FormatUint(uint64(data.(uint32)), 10)
71+
case uint64:
72+
return strconv.FormatUint(data.(uint64), 10)
6673
case float32:
6774
return strconv.FormatFloat(float64(data.(float32)), 'f', -1, 32)
6875
case float64:
6976
return strconv.FormatFloat(data.(float64), 'f', -1, 64)
7077
case string:
7178
return data.(string)
79+
case time.Time:
80+
return data.(time.Time).Format("2006-01-02 15:04:05")
7281
default:
7382
return ""
7483
}

0 commit comments

Comments
 (0)