mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #5466 from rainzm/feat/vendor_3.1
feat: Update Vendor for release/3.1
This commit is contained in:
@@ -141,11 +141,11 @@ require (
|
||||
k8s.io/klog v0.1.0 // indirect
|
||||
k8s.io/kubernetes v1.12.3
|
||||
yunion.io/x/executor v0.0.0-20200227030256-a18417815e74
|
||||
yunion.io/x/jsonutils v0.0.0-20200113074440-9297fd00ba07
|
||||
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-20200221103553-6a98f7f8ab92
|
||||
yunion.io/x/sqlchemy v0.0.0-20200312002602-1177cd8fbc57
|
||||
yunion.io/x/structarg v0.0.0-20190809075558-115bed041de3
|
||||
)
|
||||
|
||||
|
||||
@@ -701,8 +701,8 @@ yunion.io/x/executor v0.0.0-20200227030256-a18417815e74 h1:A15C6VdVRWvmQ9pAJHrUs
|
||||
yunion.io/x/executor v0.0.0-20200227030256-a18417815e74/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
|
||||
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051 h1:vtZw2iwGrsARNSwRTREGjmr2BWPdxbmXVkb3kI1qu28=
|
||||
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
|
||||
yunion.io/x/jsonutils v0.0.0-20200113074440-9297fd00ba07 h1:i6Im3w4UoyCIKOEtr0Y3aAPGrL9FYAzeFXoj3daXXt0=
|
||||
yunion.io/x/jsonutils v0.0.0-20200113074440-9297fd00ba07/go.mod h1:NpWHLv3D1iMpsp1Kv6o1ASPZmuSKutE3RIMhxKSOeAM=
|
||||
yunion.io/x/jsonutils v0.0.0-20200303051356-aa609aba0cda h1:wSwQj3MDGchGYM2RAo1riYhrTz4apH+5XyBnchuDi84=
|
||||
yunion.io/x/jsonutils v0.0.0-20200303051356-aa609aba0cda/go.mod h1:T7kxQJR13+t7z0TuT+Wzd7MTxBOk2H9c0pO1ONQSv90=
|
||||
yunion.io/x/log v0.0.0-20190514041436-04ce53b17c6b h1:Z9z+7iegu0HXuL+S8taVWRd1P4b9JJOgPXIeoqYrj7c=
|
||||
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=
|
||||
@@ -710,13 +710,13 @@ yunion.io/x/log v0.0.0-20190629062853-9f6483a7103d/go.mod h1:LC6f/4FozL0iaAbnFt2
|
||||
yunion.io/x/pkg v0.0.0-20190620104149-945c25821dbf h1:OsKC+2ghZHwp+Ztm/MwKlLKKRiE7QcPG8eTp0GmsHbg=
|
||||
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-20200103043034-27c6f82160fa h1:+7zYi8MhaOW/53/7FOERnhQqAU4UhgaOVIS+AMzTKNU=
|
||||
yunion.io/x/pkg v0.0.0-20200103043034-27c6f82160fa/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-20200221103553-6a98f7f8ab92 h1:Iz70/alKMAW3KeePhmExuhWsYw1MGTcMr5ewAL5lj1I=
|
||||
yunion.io/x/sqlchemy v0.0.0-20200221103553-6a98f7f8ab92/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=
|
||||
|
||||
Vendored
+3
-3
@@ -884,12 +884,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-20200113074440-9297fd00ba07
|
||||
# yunion.io/x/jsonutils v0.0.0-20200303051356-aa609aba0cda
|
||||
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
|
||||
@@ -921,7 +921,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-20200221103553-6a98f7f8ab92
|
||||
# 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
|
||||
|
||||
+2
-2
@@ -6,10 +6,10 @@ require (
|
||||
github.com/ghodss/yaml v1.0.0
|
||||
github.com/mattn/go-colorable v0.1.2 // indirect
|
||||
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
|
||||
github.com/pkg/errors v0.8.1
|
||||
github.com/pkg/errors v0.8.1 // indirect
|
||||
github.com/sirupsen/logrus v1.4.2 // indirect
|
||||
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4 // indirect
|
||||
gopkg.in/yaml.v2 v2.2.2 // indirect
|
||||
yunion.io/x/log v0.0.0-20190514041436-04ce53b17c6b
|
||||
yunion.io/x/pkg v0.0.0-20200103043034-27c6f82160fa
|
||||
yunion.io/x/pkg v0.0.0-20200302034534-fdf44d54b070
|
||||
)
|
||||
|
||||
+2
-4
@@ -35,7 +35,5 @@ gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
yunion.io/x/log v0.0.0-20190514041436-04ce53b17c6b h1:Z9z+7iegu0HXuL+S8taVWRd1P4b9JJOgPXIeoqYrj7c=
|
||||
yunion.io/x/log v0.0.0-20190514041436-04ce53b17c6b/go.mod h1:+gauLs73omeJAPlsXcevLsJLKixV+sR/E7WSYTSx1fE=
|
||||
yunion.io/x/pkg v0.0.0-20190620104149-945c25821dbf h1:OsKC+2ghZHwp+Ztm/MwKlLKKRiE7QcPG8eTp0GmsHbg=
|
||||
yunion.io/x/pkg v0.0.0-20190620104149-945c25821dbf/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
|
||||
yunion.io/x/pkg v0.0.0-20200103043034-27c6f82160fa h1:+7zYi8MhaOW/53/7FOERnhQqAU4UhgaOVIS+AMzTKNU=
|
||||
yunion.io/x/pkg v0.0.0-20200103043034-27c6f82160fa/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=
|
||||
|
||||
+14
-9
@@ -529,18 +529,23 @@ func setStructFieldAt(key string, v JSONObject, fieldValues reflectutils.SStruct
|
||||
return nil
|
||||
}
|
||||
visited[key] = true
|
||||
index := fieldValues.GetStructFieldIndex(key)
|
||||
if index < 0 {
|
||||
indexes := fieldValues.GetStructFieldIndexes(key)
|
||||
if len(indexes) == 0 {
|
||||
// no field match k, ignore
|
||||
return nil
|
||||
}
|
||||
err := v.unmarshalValue(fieldValues[index].Value)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "JSONDict.unmarshalStruct")
|
||||
}
|
||||
depInfo, ok := fieldValues[index].Info.Tags["deprecated-by"]
|
||||
if ok {
|
||||
return setStructFieldAt(depInfo, v, fieldValues, visited)
|
||||
for _, index := range indexes {
|
||||
err := v.unmarshalValue(fieldValues[index].Value)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "JSONDict.unmarshalStruct")
|
||||
}
|
||||
depInfo, ok := fieldValues[index].Info.Tags["deprecated-by"]
|
||||
if ok {
|
||||
err := setStructFieldAt(depInfo, v, fieldValues, visited)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "setStructFieldAt")
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
+6
-2
@@ -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 {
|
||||
|
||||
+18
-4
@@ -22,8 +22,8 @@ import (
|
||||
"strings"
|
||||
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/util/reflectutils"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/util/reflectutils"
|
||||
)
|
||||
|
||||
type IQuery interface {
|
||||
@@ -104,6 +104,8 @@ type SQuery struct {
|
||||
offset int
|
||||
|
||||
fieldCache map[string]IQueryField
|
||||
|
||||
snapshot string
|
||||
}
|
||||
|
||||
type SSubQuery struct {
|
||||
@@ -121,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())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,7 +175,7 @@ func (sq *SSubQuery) findField(id string) IQueryField {
|
||||
for i := range queryFields {
|
||||
if queryFields[i].Name() == id {
|
||||
sq.referedFields[id] = sq.query.Field(queryFields[i].Name())
|
||||
return queryFields[i]
|
||||
return sq.referedFields[id]
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -694,3 +696,15 @@ func (q *SQuery) Row2Struct(row IRowScanner, dest interface{}) error {
|
||||
}
|
||||
return q.RowMap2Struct(result, dest)
|
||||
}
|
||||
|
||||
func (q *SQuery) Snapshot() *SQuery {
|
||||
q.snapshot = q.String()
|
||||
return q
|
||||
}
|
||||
|
||||
func (q *SQuery) IsAltered() bool {
|
||||
if len(q.snapshot) == 0 {
|
||||
panic(fmt.Sprintf("Query %s has never been snapshot when IsAltered called", q.String()))
|
||||
}
|
||||
return q.String() != q.snapshot
|
||||
}
|
||||
|
||||
+3
-1
@@ -19,6 +19,7 @@ import (
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/utils"
|
||||
)
|
||||
|
||||
@@ -119,7 +120,8 @@ func (tbl *STable) Field(name string, alias ...string) IQueryField {
|
||||
name = utils.CamelSplit(name, "_")
|
||||
spec := tbl.spec.ColumnSpec(name)
|
||||
if spec == nil {
|
||||
panic("column not found: " + name)
|
||||
log.Warningf("column %s not found in table %s", name, tbl.spec.Name())
|
||||
return nil
|
||||
}
|
||||
col := STableField{table: tbl, spec: spec}
|
||||
if len(alias) > 0 {
|
||||
|
||||
+1
-7
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user