diff --git a/DONATOR.MD b/DONATOR.MD index adec8172f..a492db6a3 100644 --- a/DONATOR.MD +++ b/DONATOR.MD @@ -11,7 +11,7 @@ please note your github/gitee account in your payment bill. All the donations wi | Name | Channel | Amount | Comment |---|---|--- | --- |[hailaz](https://gitee.com/hailaz)|gitee|¥20.00 | -|[ireadx](https://github.com/ireadx)|alipay|¥301.00 | +|[ireadx](https://github.com/ireadx)|alipay|¥501.00 | |[mg91](https://gitee.com/mg91)|gitee|¥10.00 | |[pibigstar](https://github.com/pibigstar)|alipay|¥10.00 | |[tiangenglan](https://gitee.com/tiangenglan)|gitee|¥30.00 | @@ -115,7 +115,6 @@ please note your github/gitee account in your payment bill. All the donations wi |(hyuant)[https://github.com/hyuant]|alipay|¥66.66| |*庆|alipay|¥9.99| 支持一下,gf越来越好 |**君|alipay|¥10.00| 加油 -|闫沧|alipay|¥200.00| gf越来越强! diff --git a/database/gdb/gdb_z_mysql_relation_test.go b/database/gdb/gdb_z_mysql_relation_test.go index 1a7835b60..1ac691364 100644 --- a/database/gdb/gdb_z_mysql_relation_test.go +++ b/database/gdb/gdb_z_mysql_relation_test.go @@ -66,9 +66,9 @@ CREATE TABLE %s ( Address string `json:"address"` } type EntityUserScores struct { - Id int `json:"id"` - Uid int `json:"uid"` - Score int `json:"score"` + Id int `json:"id"` + UserId int `json:"uid"` + Score int `json:"score"` } type Entity struct { User *EntityUser @@ -144,10 +144,10 @@ CREATE TABLE %s ( t.Assert(err, nil) t.Assert(len(users[0].UserScores), 5) t.Assert(len(users[1].UserScores), 5) - t.Assert(users[0].UserScores[0].Uid, 3) + t.Assert(users[0].UserScores[0].UserId, 3) t.Assert(users[0].UserScores[0].Score, 1) t.Assert(users[0].UserScores[4].Score, 5) - t.Assert(users[1].UserScores[0].Uid, 4) + t.Assert(users[1].UserScores[0].UserId, 4) t.Assert(users[1].UserScores[0].Score, 1) t.Assert(users[1].UserScores[4].Score, 5) }) @@ -177,10 +177,10 @@ CREATE TABLE %s ( t.Assert(err, nil) t.Assert(len(users[0].UserScores), 5) t.Assert(len(users[1].UserScores), 5) - t.Assert(users[0].UserScores[0].Uid, 3) + t.Assert(users[0].UserScores[0].UserId, 3) t.Assert(users[0].UserScores[0].Score, 1) t.Assert(users[0].UserScores[4].Score, 5) - t.Assert(users[1].UserScores[0].Uid, 4) + t.Assert(users[1].UserScores[0].UserId, 4) t.Assert(users[1].UserScores[0].Score, 1) t.Assert(users[1].UserScores[4].Score, 5) }) @@ -319,10 +319,10 @@ CREATE TABLE %s ( t.Assert(len(users[0].UserScores), 5) t.Assert(len(users[1].UserScores), 5) - t.Assert(users[0].UserScores[0].Uid, 3) + t.Assert(users[0].UserScores[0].UserId, 3) t.Assert(users[0].UserScores[0].Score, 1) t.Assert(users[0].UserScores[4].Score, 5) - t.Assert(users[1].UserScores[0].Uid, 4) + t.Assert(users[1].UserScores[0].UserId, 4) t.Assert(users[1].UserScores[0].Score, 1) t.Assert(users[1].UserScores[4].Score, 5) }) diff --git a/net/ghttp/ghttp_request_param_form.go b/net/ghttp/ghttp_request_param_form.go index 7c4a5d150..01e121cb3 100644 --- a/net/ghttp/ghttp_request_param_form.go +++ b/net/ghttp/ghttp_request_param_form.go @@ -189,10 +189,11 @@ func (r *Request) GetFormMapStrVar(kvMap ...map[string]interface{}) map[string]* // The optional parameter is used to specify the key to attribute mapping. func (r *Request) GetFormStruct(pointer interface{}, mapping ...map[string]string) error { r.parseForm() - if len(r.formMap) == 0 { - return nil + m := r.formMap + if m == nil { + m = map[string]interface{}{} } - return gconv.StructDeep(r.formMap, pointer, mapping...) + return gconv.StructDeep(m, pointer, mapping...) } // GetFormToStruct is alias of GetFormStruct. See GetFormStruct. diff --git a/net/ghttp/ghttp_request_param_query.go b/net/ghttp/ghttp_request_param_query.go index 042da32f9..7f75fb2c6 100644 --- a/net/ghttp/ghttp_request_param_query.go +++ b/net/ghttp/ghttp_request_param_query.go @@ -194,8 +194,8 @@ func (r *Request) GetQueryMapStrVar(kvMap ...map[string]interface{}) map[string] func (r *Request) GetQueryStruct(pointer interface{}, mapping ...map[string]string) error { r.parseQuery() m := r.GetQueryMap() - if len(m) == 0 { - return nil + if m == nil { + m = map[string]interface{}{} } return gconv.StructDeep(m, pointer, mapping...) } diff --git a/net/ghttp/ghttp_request_param_request.go b/net/ghttp/ghttp_request_param_request.go index cb973e511..29e0a4375 100644 --- a/net/ghttp/ghttp_request_param_request.go +++ b/net/ghttp/ghttp_request_param_request.go @@ -268,8 +268,8 @@ func (r *Request) GetRequestMapStrVar(kvMap ...map[string]interface{}) map[strin // The optional parameter is used to specify the key to attribute mapping. func (r *Request) GetRequestStruct(pointer interface{}, mapping ...map[string]string) error { m := r.GetRequestMap() - if len(m) == 0 { - return nil + if m == nil { + m = map[string]interface{}{} } return gconv.StructDeep(m, pointer, mapping...) }