diff --git a/go.mod b/go.mod index cc1f5fb637..febe86ab4c 100644 --- a/go.mod +++ b/go.mod @@ -142,9 +142,9 @@ require ( yunion.io/x/executor v0.0.0-20200227030256-a18417815e74 yunion.io/x/jsonutils v0.0.0-20200303051356-aa609aba0cda yunion.io/x/log v0.0.0-20190629062853-9f6483a7103d - yunion.io/x/pkg v0.0.0-20200302034534-fdf44d54b070 + yunion.io/x/pkg v0.0.0-20200304112442-9dae9351325e yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e - yunion.io/x/sqlchemy v0.0.0-20200303101347-d1e82c81b4e1 + yunion.io/x/sqlchemy v0.0.0-20200312002602-1177cd8fbc57 yunion.io/x/structarg v0.0.0-20190809075558-115bed041de3 ) diff --git a/go.sum b/go.sum index f33c22a092..41b1d910ed 100644 --- a/go.sum +++ b/go.sum @@ -837,9 +837,13 @@ yunion.io/x/pkg v0.0.0-20190620104149-945c25821dbf/go.mod h1:t6rEGG2sQ4J7DhFxSZV yunion.io/x/pkg v0.0.0-20190628082551-f4033ba2ea30/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E= yunion.io/x/pkg v0.0.0-20200302034534-fdf44d54b070 h1:rKnYgtvMHKmzPEUTkyNjyKOG7wzjpUvI7fcZwLNGQXw= yunion.io/x/pkg v0.0.0-20200302034534-fdf44d54b070/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E= +yunion.io/x/pkg v0.0.0-20200304112442-9dae9351325e h1:rBfX77+VEBVpe6Xxy2gDa4WB7qbtndWvXcrVKzleF84= +yunion.io/x/pkg v0.0.0-20200304112442-9dae9351325e/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-20200303101347-d1e82c81b4e1 h1:OJrTCU1YooMykhSIsYvvJsOE+BdXIVXf4LgfDP7mibE= yunion.io/x/sqlchemy v0.0.0-20200303101347-d1e82c81b4e1/go.mod h1:FTdwPdGhMgh4E+UFXc9klI1Ok34fMuybTT+jLhOaIjI= +yunion.io/x/sqlchemy v0.0.0-20200312002602-1177cd8fbc57 h1:KtQAuLJ00RSUVqkiRmJ1DiDABiw0U3xxXnzD3lGavaY= +yunion.io/x/sqlchemy v0.0.0-20200312002602-1177cd8fbc57/go.mod h1:FTdwPdGhMgh4E+UFXc9klI1Ok34fMuybTT+jLhOaIjI= yunion.io/x/structarg v0.0.0-20190809075558-115bed041de3 h1:bfC8EhXYvyGYldRWlzxiCM39Zfj3s3+zham9mW2h2LE= yunion.io/x/structarg v0.0.0-20190809075558-115bed041de3/go.mod h1:EP6NSv2C0zzqBDTKumv8hPWLb3XvgMZDHQRfyuOrQng= diff --git a/vendor/modules.txt b/vendor/modules.txt index 64c6f4a88c..6fba70c738 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -979,7 +979,7 @@ yunion.io/x/jsonutils # yunion.io/x/log v0.0.0-20190629062853-9f6483a7103d yunion.io/x/log yunion.io/x/log/hooks -# yunion.io/x/pkg v0.0.0-20200302034534-fdf44d54b070 +# yunion.io/x/pkg v0.0.0-20200304112442-9dae9351325e yunion.io/x/pkg/errors yunion.io/x/pkg/gotypes yunion.io/x/pkg/prettytable @@ -1011,7 +1011,7 @@ yunion.io/x/pkg/util/workqueue yunion.io/x/pkg/utils # yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e yunion.io/x/s3cli -# yunion.io/x/sqlchemy v0.0.0-20200303101347-d1e82c81b4e1 +# yunion.io/x/sqlchemy v0.0.0-20200312002602-1177cd8fbc57 yunion.io/x/sqlchemy # yunion.io/x/structarg v0.0.0-20190809075558-115bed041de3 yunion.io/x/structarg diff --git a/vendor/yunion.io/x/pkg/util/reflectutils/jsonfield.go b/vendor/yunion.io/x/pkg/util/reflectutils/jsonfield.go index b19f02feb3..8871c1431f 100644 --- a/vendor/yunion.io/x/pkg/util/reflectutils/jsonfield.go +++ b/vendor/yunion.io/x/pkg/util/reflectutils/jsonfield.go @@ -63,13 +63,17 @@ func (s SStructFieldInfo) deepCopy() *SStructFieldInfo { } func ParseStructFieldJsonInfo(sf reflect.StructField) SStructFieldInfo { + return ParseFieldJsonInfo(sf.Name, sf.Tag) +} + +func ParseFieldJsonInfo(name string, tag reflect.StructTag) SStructFieldInfo { info := SStructFieldInfo{} - info.FieldName = sf.Name + info.FieldName = name info.OmitEmpty = true info.OmitZero = false info.OmitFalse = false - info.Tags = utils.TagMap(sf.Tag) + info.Tags = utils.TagMap(tag) if val, ok := info.Tags["json"]; ok { keys := strings.Split(val, ",") if len(keys) > 0 { diff --git a/vendor/yunion.io/x/sqlchemy/query.go b/vendor/yunion.io/x/sqlchemy/query.go index ee62f7cf67..499463067b 100644 --- a/vendor/yunion.io/x/sqlchemy/query.go +++ b/vendor/yunion.io/x/sqlchemy/query.go @@ -123,9 +123,9 @@ type SSubQueryField struct { func (sqf *SSubQueryField) Expression() string { if len(sqf.alias) > 0 { - return fmt.Sprintf("%s.%s AS %s", sqf.query.alias, sqf.field.Name(), sqf.alias) + return fmt.Sprintf("`%s`.`%s` AS `%s`", sqf.query.alias, sqf.field.Name(), sqf.alias) } else { - return fmt.Sprintf("%s.%s", sqf.query.alias, sqf.field.Name()) + return fmt.Sprintf("`%s`.`%s`", sqf.query.alias, sqf.field.Name()) } } diff --git a/vendor/yunion.io/x/sqlchemy/update.go b/vendor/yunion.io/x/sqlchemy/update.go index 700210325b..a122da432a 100644 --- a/vendor/yunion.io/x/sqlchemy/update.go +++ b/vendor/yunion.io/x/sqlchemy/update.go @@ -105,7 +105,7 @@ func (us *SUpdateSession) saveUpdate(dt interface{}) (UpdateDiffs, error) { nf, _ := fields.GetInterface(k) if c.IsPrimary() { if !gotypes.IsNil(of) && !c.IsZero(of) { - primaries[k] = of + primaries[k] = c.ConvertFromValue(of) } else if c.IsText() { primaries[k] = "" } else { @@ -113,12 +113,6 @@ func (us *SUpdateSession) saveUpdate(dt interface{}) (UpdateDiffs, error) { } continue } - if !gotypes.IsNil(of) { - if c.IsPrimary() && !c.IsZero(of) { // skip update primary key - primaries[k] = of - continue - } - } nc, ok := c.(*SIntegerColumn) if ok && nc.IsAutoVersion { versionFields = append(versionFields, k)