mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
mark gconv.StructDeep/StructsDeep deprecated
This commit is contained in:
@ -315,6 +315,7 @@ func (j *Json) GetStruct(pattern string, pointer interface{}, mapping ...map[str
|
||||
}
|
||||
|
||||
// GetStructDeep does GetStruct recursively.
|
||||
// Deprecated, use GetStruct instead.
|
||||
func (j *Json) GetStructDeep(pattern string, pointer interface{}, mapping ...map[string]string) error {
|
||||
return gconv.StructDeep(j.Get(pattern), pointer, mapping...)
|
||||
}
|
||||
@ -325,6 +326,7 @@ func (j *Json) GetStructs(pattern string, pointer interface{}, mapping ...map[st
|
||||
}
|
||||
|
||||
// GetStructsDeep converts any slice to given struct slice recursively.
|
||||
// Deprecated, use GetStructs instead.
|
||||
func (j *Json) GetStructsDeep(pattern string, pointer interface{}, mapping ...map[string]string) error {
|
||||
return gconv.StructsDeep(j.Get(pattern), pointer, mapping...)
|
||||
}
|
||||
@ -394,6 +396,7 @@ func (j *Json) ToStruct(pointer interface{}, mapping ...map[string]string) error
|
||||
|
||||
// ToStructDeep converts current Json object to specified object recursively.
|
||||
// The <pointer> should be a pointer type of *struct.
|
||||
// Deprecated, use ToStruct instead.
|
||||
func (j *Json) ToStructDeep(pointer interface{}, mapping ...map[string]string) error {
|
||||
j.mu.RLock()
|
||||
defer j.mu.RUnlock()
|
||||
|
||||
@ -203,7 +203,7 @@ func Test_ToStruct1(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func Test_ToStructDeep(t *testing.T) {
|
||||
func Test_ToStruct(t *testing.T) {
|
||||
gtest.C(t, func(t *gtest.T) {
|
||||
type Item struct {
|
||||
Title string `json:"title"`
|
||||
@ -231,7 +231,7 @@ func Test_ToStructDeep(t *testing.T) {
|
||||
t.Assert(j.GetBool("items"), false)
|
||||
t.Assert(j.GetArray("items"), nil)
|
||||
m := new(M)
|
||||
err = j.ToStructDeep(m)
|
||||
err = j.ToStruct(m)
|
||||
t.Assert(err, nil)
|
||||
t.AssertNE(m.Me, nil)
|
||||
t.Assert(m.Me["day"], "20009")
|
||||
|
||||
Reference in New Issue
Block a user