优化null相关

This commit is contained in:
xiangheng
2024-08-16 12:33:23 +08:00
parent 8e75b9b54a
commit fe6ec94516
2 changed files with 25 additions and 4 deletions

View File

@@ -27,10 +27,20 @@ func (t nullTimeUtil) EncodeTime(value any) any {
var str = ""
switch v := value.(type) {
case map[string]interface{}:
tt := v["Time"]
val := v["Time"]
switch tt := val.(type) {
case *string:
ttt, _ := t.Parse(*tt)
str = ttt.String()
case *time.Time:
if tt != nil {
ttt, _ := t.Parse(*tt)
str = ttt.String()
} else {
str = ""
}
}
ttt, _ := t.Parse(tt)
str = ttt.String()
}
return str
}