update vendor

This commit is contained in:
Qiu Jian
2020-04-15 21:25:50 +08:00
parent cdd239eab5
commit 5651805eb0
6 changed files with 46 additions and 44 deletions

4
go.mod
View File

@@ -128,9 +128,9 @@ require (
k8s.io/cluster-bootstrap v0.17.3
k8s.io/kubernetes v1.16.0
yunion.io/x/executor v0.0.0-20200227030256-a18417815e74
yunion.io/x/jsonutils v0.0.0-20200330063846-589d9924bb8b
yunion.io/x/jsonutils v0.0.0-20200415132054-2bf8a5e94501
yunion.io/x/log v0.0.0-20200313080802-57a4ce5966b3
yunion.io/x/pkg v0.0.0-20200414143921-085f89a6e1e9
yunion.io/x/pkg v0.0.0-20200415124010-2c7da30b998f
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
yunion.io/x/sqlchemy v0.0.0-20200312002602-1177cd8fbc57
yunion.io/x/structarg v0.0.0-20190809075558-115bed041de3

8
go.sum
View File

@@ -1106,8 +1106,8 @@ vbom.ml/util v0.0.0-20160121211510-db5cfe13f5cc/go.mod h1:so/NYdZXCz+E3ZpW0uAoCj
yunion.io/x/executor v0.0.0-20200227030256-a18417815e74 h1:A15C6VdVRWvmQ9pAJHrUs9yan5qKlYH7uaRxHg1kRbk=
yunion.io/x/executor v0.0.0-20200227030256-a18417815e74/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
yunion.io/x/jsonutils v0.0.0-20200330063846-589d9924bb8b h1:mt0TOKRk76yeH0whJfmKsceXBuudXLjvoj8NKGTqpEU=
yunion.io/x/jsonutils v0.0.0-20200330063846-589d9924bb8b/go.mod h1:T7kxQJR13+t7z0TuT+Wzd7MTxBOk2H9c0pO1ONQSv90=
yunion.io/x/jsonutils v0.0.0-20200415132054-2bf8a5e94501 h1:i1r9XvbdxH3FgTCLmTaRi3MzQqhiQimXJRlUOPgrxnU=
yunion.io/x/jsonutils v0.0.0-20200415132054-2bf8a5e94501/go.mod h1:T7kxQJR13+t7z0TuT+Wzd7MTxBOk2H9c0pO1ONQSv90=
yunion.io/x/log v0.0.0-20190514041436-04ce53b17c6b/go.mod h1:+gauLs73omeJAPlsXcevLsJLKixV+sR/E7WSYTSx1fE=
yunion.io/x/log v0.0.0-20190629062853-9f6483a7103d h1:59zrDL7Ft+hDukguJRmLr/Gdu/9V75x+yX99ovZwfaA=
yunion.io/x/log v0.0.0-20190629062853-9f6483a7103d/go.mod h1:LC6f/4FozL0iaAbnFt2eDX9jlsyo3WiOUPm03d7+U4U=
@@ -1116,8 +1116,8 @@ yunion.io/x/log v0.0.0-20200313080802-57a4ce5966b3/go.mod h1:LC6f/4FozL0iaAbnFt2
yunion.io/x/pkg v0.0.0-20190620104149-945c25821dbf/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
yunion.io/x/pkg v0.0.0-20190628082551-f4033ba2ea30/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
yunion.io/x/pkg v0.0.0-20200302034534-fdf44d54b070/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
yunion.io/x/pkg v0.0.0-20200414143921-085f89a6e1e9 h1:baz7ZPSEPXG24d30B1a8CuYXvG7reykwCW2nzdTTs3s=
yunion.io/x/pkg v0.0.0-20200414143921-085f89a6e1e9/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
yunion.io/x/pkg v0.0.0-20200415124010-2c7da30b998f h1:7aKKuquYIFESmLnti3ea0IhGMZ1K1JnP/1XeJg59bmA=
yunion.io/x/pkg v0.0.0-20200415124010-2c7da30b998f/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e h1:v+EzIadodSwkdZ/7bremd7J8J50Cise/HCylsOJngmo=
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e/go.mod h1:0iFKpOs1y4lbCxeOmq3Xx/0AcQoewVPwj62eRluioEo=
yunion.io/x/sqlchemy v0.0.0-20200312002602-1177cd8fbc57 h1:KtQAuLJ00RSUVqkiRmJ1DiDABiw0U3xxXnzD3lGavaY=

4
vendor/modules.txt vendored
View File

@@ -1014,12 +1014,12 @@ sigs.k8s.io/yaml
yunion.io/x/executor/apis
yunion.io/x/executor/client
yunion.io/x/executor/server
# yunion.io/x/jsonutils v0.0.0-20200330063846-589d9924bb8b
# yunion.io/x/jsonutils v0.0.0-20200415132054-2bf8a5e94501
yunion.io/x/jsonutils
# yunion.io/x/log v0.0.0-20200313080802-57a4ce5966b3
yunion.io/x/log
yunion.io/x/log/hooks
# yunion.io/x/pkg v0.0.0-20200403115157-880d716ed624
# yunion.io/x/pkg v0.0.0-20200415124010-2c7da30b998f
yunion.io/x/pkg/errors
yunion.io/x/pkg/gotypes
yunion.io/x/pkg/prettytable

View File

@@ -14,6 +14,10 @@
package jsonutils
const (
TAG_DEPRECATED_BY = "deprecated-by"
import (
"yunion.io/x/pkg/util/reflectutils"
)
const (
TAG_DEPRECATED_BY = reflectutils.TAG_DEPRECATED_BY
)

View File

@@ -520,7 +520,7 @@ func (this *JSONDict) unmarshalMap(val reflect.Value) error {
return nil
}
func setStructFieldAt(key string, v JSONObject, fieldValues reflectutils.SStructFieldValueSet, visited map[string]bool) error {
func setStructFieldAt(key string, v JSONObject, fieldValues reflectutils.SStructFieldValueSet, keyIndexMap map[string][]int, visited map[string]bool) error {
if visited == nil {
visited = make(map[string]bool)
}
@@ -529,10 +529,14 @@ func setStructFieldAt(key string, v JSONObject, fieldValues reflectutils.SStruct
return nil
}
visited[key] = true
indexes := fieldValues.GetStructFieldIndexes(key)
if len(indexes) == 0 {
// no field match k, ignore
return nil
indexes, ok := keyIndexMap[key]
if !ok || len(indexes) == 0 {
// try less strict match name
indexes = fieldValues.GetStructFieldIndexes2(key, false)
if len(indexes) == 0 {
// no field match k, ignore
return nil
}
}
for _, index := range indexes {
err := v.unmarshalValue(fieldValues[index].Value)
@@ -541,7 +545,7 @@ func setStructFieldAt(key string, v JSONObject, fieldValues reflectutils.SStruct
}
depInfo, ok := fieldValues[index].Info.Tags[TAG_DEPRECATED_BY]
if ok {
err := setStructFieldAt(depInfo, v, fieldValues, visited)
err := setStructFieldAt(depInfo, v, fieldValues, keyIndexMap, visited)
if err != nil {
return errors.Wrap(err, "setStructFieldAt")
}
@@ -552,8 +556,9 @@ func setStructFieldAt(key string, v JSONObject, fieldValues reflectutils.SStruct
func (this *JSONDict) unmarshalStruct(val reflect.Value) error {
fieldValues := reflectutils.FetchStructFieldValueSetForWrite(val)
keyIndexMap := fieldValues.GetStructFieldIndexesMap()
for k, v := range this.data {
err := setStructFieldAt(k, v, fieldValues, nil)
err := setStructFieldAt(k, v, fieldValues, keyIndexMap, nil)
if err != nil {
return errors.Wrapf(err, "setStructFieldAt %s: %s", k, v)
}

View File

@@ -257,27 +257,18 @@ func fetchStructFieldValueSet(dataValue reflect.Value, allocatePtr bool, tags ma
}
func (fields SStructFieldValueSet) GetStructFieldIndex(name string) int {
for i := range fields {
if fields[i].Info.Ignore {
continue
}
if fields[i].Info.MarshalName() == name {
return i
}
/*if utils.CamelSplit(jsonInfo.FieldName, "_") == utils.CamelSplit(name, "_") {
return i
}
if jsonInfo.FieldName == name {
return i
}
if jsonInfo.FieldName == utils.Capitalize(name) {
return i
}*/
indexes := fields.GetStructFieldIndexes(name)
if len(indexes) > 0 {
return indexes[0]
}
return -1
}
func (fields SStructFieldValueSet) GetStructFieldIndexes(name string) []int {
return fields.GetStructFieldIndexes2(name, false)
}
func (fields SStructFieldValueSet) GetStructFieldIndexes2(name string, strictMode bool) []int {
ret := make([]int, 0)
for i := range fields {
if fields[i].Info.Ignore {
@@ -287,18 +278,20 @@ func (fields SStructFieldValueSet) GetStructFieldIndexes(name string) []int {
ret = append(ret, i)
continue
}
/*if utils.CamelSplit(jsonInfo.FieldName, "_") == utils.CamelSplit(name, "_") {
ret = append(ret, i)
continue
if !strictMode {
if utils.CamelSplit(fields[i].Info.FieldName, "_") == utils.CamelSplit(name, "_") {
ret = append(ret, i)
continue
}
if fields[i].Info.FieldName == name {
ret = append(ret, i)
continue
}
if fields[i].Info.FieldName == utils.Capitalize(name) {
ret = append(ret, i)
continue
}
}
if jsonInfo.FieldName == name {
ret = append(ret, i)
continue
}
if jsonInfo.FieldName == utils.Capitalize(name) {
ret = append(ret, i)
continue
}*/
}
return ret
}