fix issue in nil gtime attribute for model entity for package gdb

This commit is contained in:
Jack 2020-08-31 00:39:12 +08:00
parent 87c22d32b0
commit 0415cf6a08
3 changed files with 15 additions and 15 deletions

View File

@ -182,7 +182,7 @@ func DataToMapDeep(value interface{}) map[string]interface{} {
// The underlying driver supports time.Time/*time.Time types.
fieldValue := rvField.Interface()
switch fieldValue.(type) {
case time.Time, *time.Time:
case time.Time, *time.Time, gtime.Time, *gtime.Time:
data[name] = fieldValue
default:
// Use string conversion in default.

View File

@ -52,20 +52,20 @@ func Test_Model_Insert(t *testing.T) {
t.Assert(n, 1)
type User struct {
Id int `gconv:"id"`
Uid int `gconv:"uid"`
Passport string `json:"passport"`
Password string `gconv:"password"`
Nickname string `gconv:"nickname"`
CreateTime string `json:"create_time"`
Id int `gconv:"id"`
Uid int `gconv:"uid"`
Passport string `json:"passport"`
Password string `gconv:"password"`
Nickname string `gconv:"nickname"`
CreateTime *gtime.Time `json:"create_time"`
}
// Model inserting.
result, err = db.Table(table).Filter().Data(User{
Id: 3,
Uid: 3,
Passport: "t3",
Password: "25d55ad283aa400af464c76d713c07ad",
Nickname: "name_3",
CreateTime: gtime.Now().String(),
Id: 3,
Uid: 3,
Passport: "t3",
Password: "25d55ad283aa400af464c76d713c07ad",
Nickname: "name_3",
}).Insert()
t.Assert(err, nil)
n, _ = result.RowsAffected()
@ -80,7 +80,7 @@ func Test_Model_Insert(t *testing.T) {
Passport: "t4",
Password: "25d55ad283aa400af464c76d713c07ad",
Nickname: "T4",
CreateTime: gtime.Now().String(),
CreateTime: gtime.Now(),
}).Insert()
t.Assert(err, nil)
n, _ = result.RowsAffected()

View File

@ -1,4 +1,4 @@
package gf
const VERSION = "v1.13.4"
const VERSION = "v1.13.5-alpha"
const AUTHORS = "john<john@goframe.org>"