update vendor for sqlchemy update master 20220703 (#14571)

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
Jian Qiu
2022-07-03 12:51:23 +08:00
committed by GitHub
co-authored by Qiu Jian
parent d51d7599d2
commit 0b11c57eca
7 changed files with 23 additions and 7 deletions
+1 -1
View File
@@ -105,7 +105,7 @@ require (
yunion.io/x/ovsdb v0.0.0-20200526071744-27bf0940cbc7
yunion.io/x/pkg v1.0.1-0.20220630095420-9925accd7c5e
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
yunion.io/x/sqlchemy v1.1.2-0.20220702013738-1246c22e7bd0
yunion.io/x/sqlchemy v1.1.2-0.20220703025206-ec715f60e8cc
yunion.io/x/structarg v0.0.0-20220312084958-9c6c79c7d1c6
)
+2 -2
View File
@@ -1135,7 +1135,7 @@ yunion.io/x/pkg v1.0.1-0.20220630095420-9925accd7c5e h1:p/Cb7z6gyJbZKnGMeOPL3pTm
yunion.io/x/pkg v1.0.1-0.20220630095420-9925accd7c5e/go.mod h1:nYOMflWG1wQC6301rGVglQva9bYbJxHThEJUxRAgMFc=
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 v1.1.2-0.20220702013738-1246c22e7bd0 h1:3SLS0y2oPKL26HuEgs84I1/a2El3hUILqRCzeyzL/3o=
yunion.io/x/sqlchemy v1.1.2-0.20220702013738-1246c22e7bd0/go.mod h1:xXVfJLIxxTRTnPEaVIIoRZXqWyO8+takIOYhc+zO5KE=
yunion.io/x/sqlchemy v1.1.2-0.20220703025206-ec715f60e8cc h1:+wNGxBMzzcDTQ6zhkuKDygZ9GPOAgxd+7tYsqorSpn0=
yunion.io/x/sqlchemy v1.1.2-0.20220703025206-ec715f60e8cc/go.mod h1:xXVfJLIxxTRTnPEaVIIoRZXqWyO8+takIOYhc+zO5KE=
yunion.io/x/structarg v0.0.0-20220312084958-9c6c79c7d1c6 h1:WuWXhY3DvhdRTzWCJ/kwt3Ss6KIq7+KqJwb+esvNGwU=
yunion.io/x/structarg v0.0.0-20220312084958-9c6c79c7d1c6/go.mod h1:EP6NSv2C0zzqBDTKumv8hPWLb3XvgMZDHQRfyuOrQng=
+1 -1
View File
@@ -1483,7 +1483,7 @@ yunion.io/x/pkg/utils
# yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
## explicit; go 1.12
yunion.io/x/s3cli
# yunion.io/x/sqlchemy v1.1.2-0.20220702013738-1246c22e7bd0
# yunion.io/x/sqlchemy v1.1.2-0.20220703025206-ec715f60e8cc
## explicit; go 1.17
yunion.io/x/sqlchemy
yunion.io/x/sqlchemy/backends
+2
View File
@@ -59,6 +59,8 @@ type IBackend interface {
UnionAllString() string
//
UnionDistinctString() string
// support mixed insert vars
SupportMixedInsertVariables() bool
// Capability
+4
View File
@@ -84,6 +84,10 @@ func (click *SClickhouseBackend) UnionDistinctString() string {
return "UNION DISTINCT"
}
func (click *SClickhouseBackend) SupportMixedInsertVariables() bool {
return false
}
func (click *SClickhouseBackend) UpdateSQLTemplate() string {
return "ALTER TABLE `{{ .Table }}` UPDATE {{ .Columns }} WHERE {{ .Conditions }}"
}
+4
View File
@@ -68,6 +68,10 @@ func (bb *SBaseBackend) UnionDistinctString() string {
return "UNION"
}
func (bb *SBaseBackend) SupportMixedInsertVariables() bool {
return true
}
func (bb *SBaseBackend) CanUpdate() bool {
return false
}
+9 -3
View File
@@ -18,6 +18,7 @@ import (
"fmt"
"reflect"
"strings"
"time"
"yunion.io/x/log"
"yunion.io/x/pkg/errors"
@@ -62,6 +63,8 @@ func (t *STableSpec) InsertSqlPrep(data interface{}, update bool) (*InsertSqlRes
var autoIncField string
createdAtFields := make([]string, 0)
now := time.Now().UTC()
names := make([]string, 0)
format := make([]string, 0)
values := make([]interface{}, 0)
@@ -95,9 +98,12 @@ func (t *STableSpec) InsertSqlPrep(data interface{}, update bool) (*InsertSqlRes
createdAtFields = append(createdAtFields, k)
names = append(names, fmt.Sprintf("`%s`", k))
if c.IsZero(ov) {
format = append(format, t.Database().backend.CurrentUTCTimeStampString())
// values = append(values, now)
// format = append(format, "?")
if t.Database().backend.SupportMixedInsertVariables() {
format = append(format, t.Database().backend.CurrentUTCTimeStampString())
} else {
values = append(values, now)
format = append(format, "?")
}
} else {
values = append(values, ov)
format = append(format, "?")