|
|
@ -3,7 +3,6 @@ package utils |
|
|
|
import ( |
|
|
|
"reflect" |
|
|
|
"strconv" |
|
|
|
"time" |
|
|
|
) |
|
|
|
|
|
|
|
func ValueType(in interface{}) string { |
|
|
@ -205,30 +204,6 @@ func ValueToStringIn(in interface{}, def string, fixed int) string { |
|
|
|
return def |
|
|
|
} |
|
|
|
|
|
|
|
func ValueToTime(in interface{}, timeFormat string, def string) string { |
|
|
|
if in == nil { |
|
|
|
return def |
|
|
|
} |
|
|
|
switch in.(type) { |
|
|
|
case time.Time: |
|
|
|
return TimeFormat(in.(time.Time), timeFormat) |
|
|
|
case *time.Time: |
|
|
|
return TimeFormat(*(in.(*time.Time)), timeFormat) |
|
|
|
case []byte: |
|
|
|
return string(in.([]byte)) |
|
|
|
case string: |
|
|
|
return in.(string) |
|
|
|
case *[]byte: |
|
|
|
return string(*(in.(*[]byte))) |
|
|
|
case *string: |
|
|
|
return *(in.(*string)) |
|
|
|
default: |
|
|
|
res := ValueToInt(in, 0) |
|
|
|
return TimeFormat(time.Unix(int64(res), 0), timeFormat) |
|
|
|
} |
|
|
|
return def |
|
|
|
} |
|
|
|
|
|
|
|
func ValueIsEmpty(in interface{}) bool { |
|
|
|
if in == nil { |
|
|
|
return true |
|
|
|