增加time类型直接转换

This commit is contained in:
hoteas
2022-05-13 15:31:55 +08:00
parent 20d8926d05
commit cbcfd735ca
5 changed files with 112 additions and 0 deletions
+9
View File
@@ -1,5 +1,7 @@
package common
import "time"
//对象封装方便取用
type Obj struct {
Data interface{}
@@ -18,6 +20,13 @@ func (that *Obj) ToInt(err ...Error) int {
return ObjToInt(that.Data, &that.Error)
}
func (that *Obj) ToTime(err ...Error) time.Time {
if len(err) != 0 {
that.Error = err[0]
}
return ObjToTime(that.Data, &that.Error)
}
func (that *Obj) ToInt64(err ...Error) int64 {
if len(err) != 0 {
that.Error = err[0]