From 9cc9fd087270ecce0fbc1d40c56d5e588aa62cf4 Mon Sep 17 00:00:00 2001 From: Jian Qiu Date: Sun, 21 Nov 2021 10:01:18 +0800 Subject: [PATCH] fix: update vendor 20211121 (#12718) Co-authored-by: Qiu Jian --- go.mod | 2 +- go.sum | 4 ++-- vendor/modules.txt | 2 +- vendor/yunion.io/x/sqlchemy/README.md | 10 +++++----- vendor/yunion.io/x/sqlchemy/functions.go | 14 ++++++++++++-- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index eccae617d9..55620f2c2e 100644 --- a/go.mod +++ b/go.mod @@ -157,6 +157,6 @@ require ( yunion.io/x/ovsdb v0.0.0-20200526071744-27bf0940cbc7 yunion.io/x/pkg v0.0.0-20211116020154-6a76ba2f7e97 yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e - yunion.io/x/sqlchemy v0.0.0-20211116231750-5ec40db49db1 + yunion.io/x/sqlchemy v0.0.0-20211121015201-266a5b1a8f5c yunion.io/x/structarg v0.0.0-20200720093445-9f850fa222ce ) diff --git a/go.sum b/go.sum index e44352f7c9..e9e1f7601a 100644 --- a/go.sum +++ b/go.sum @@ -955,7 +955,7 @@ yunion.io/x/pkg v0.0.0-20211116020154-6a76ba2f7e97 h1:lY+5NlWwO2aIkfNnVOGKHmZvMt yunion.io/x/pkg v0.0.0-20211116020154-6a76ba2f7e97/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-20211116231750-5ec40db49db1 h1:WxvTLANfa01EFTORGY2GapbdjQkuLaQ/CwMDdBy632U= -yunion.io/x/sqlchemy v0.0.0-20211116231750-5ec40db49db1/go.mod h1:FTdwPdGhMgh4E+UFXc9klI1Ok34fMuybTT+jLhOaIjI= +yunion.io/x/sqlchemy v0.0.0-20211121015201-266a5b1a8f5c h1:nnYn2VBFwwrAx6HuUN6Lv+BKxtBnOSPGWUWGvdeuUr4= +yunion.io/x/sqlchemy v0.0.0-20211121015201-266a5b1a8f5c/go.mod h1:FTdwPdGhMgh4E+UFXc9klI1Ok34fMuybTT+jLhOaIjI= yunion.io/x/structarg v0.0.0-20200720093445-9f850fa222ce h1:kU8xE7O5uZ1GSJVMZHoJ+jrNL7csUQHYGyAPW9QfNpE= yunion.io/x/structarg v0.0.0-20200720093445-9f850fa222ce/go.mod h1:EP6NSv2C0zzqBDTKumv8hPWLb3XvgMZDHQRfyuOrQng= diff --git a/vendor/modules.txt b/vendor/modules.txt index 8bfaec87fb..35dc58b687 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1223,7 +1223,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-20211116231750-5ec40db49db1 +# yunion.io/x/sqlchemy v0.0.0-20211121015201-266a5b1a8f5c yunion.io/x/sqlchemy yunion.io/x/sqlchemy/backends yunion.io/x/sqlchemy/backends/clickhouse diff --git a/vendor/yunion.io/x/sqlchemy/README.md b/vendor/yunion.io/x/sqlchemy/README.md index 2f786b23e8..d352bd5ea1 100644 --- a/vendor/yunion.io/x/sqlchemy/README.md +++ b/vendor/yunion.io/x/sqlchemy/README.md @@ -11,8 +11,8 @@ Features * Automatic creation and synchronization of table schema based on golang struct * Query syntax inpired by sqlalchemy -* Support: MySQL/MariaDB with InnoDB engine/SQLITE(Exprimental)/ClickHouse(Exprimental) -* Support select, insert, update and insert or update +* Support: MySQL/MariaDB with InnoDB engine / Sqlite (Exprimental) / ClickHouse (Exprimental) +* Support select, insert, update and insertOrupdate (no delete) Quick Examples ---------------- @@ -29,7 +29,7 @@ dbconn := sql.Open("mysql", "testgo:openstack@tcp(127.0.0.1:3306)/testgo?charset sqlchemy.SetDefaultDB(dbconn) ``` -### Setup database with MySQL with InnoDB +### Setup database with MySQL with InnoDB explicitly ```go dbconn := sql.Open("mysql", "testgo:openstack@tcp(127.0.0.1:3306)/testgo?charset=utf8&parseTime") @@ -44,7 +44,7 @@ dbconn := sql.Open("sqlite3", "file:mydb.s3db?cache=shared&mode=rwc") sqlchemy.SetDBWithNameBackend(dbconn, sqlchemy.DBName("sqlitedb"), sqlchemy.SQLiteBackend) ``` -### Setup database with clickhosue +### Setup database with ClickHouse ```go dbconn := sql.Open("clickhouse", "tcp://host1:9000?username=user&password=qwerty&database=clicks") @@ -71,7 +71,7 @@ type TestTable struct { Deleted bool `nullable:"false" default:"false"` Notes string `default:"default notes"` } -```` +``` ## Table initialization diff --git a/vendor/yunion.io/x/sqlchemy/functions.go b/vendor/yunion.io/x/sqlchemy/functions.go index 0cbe64b307..fb07493982 100644 --- a/vendor/yunion.io/x/sqlchemy/functions.go +++ b/vendor/yunion.io/x/sqlchemy/functions.go @@ -157,7 +157,12 @@ type SConstField struct { // Expression implementation of SConstField for IQueryField func (s *SConstField) Expression() string { - return fmt.Sprintf("%s AS `%s`", s.Reference(), s.Name()) + name := s.Name() + if len(name) == 0 { + return s.Reference() + } else { + return fmt.Sprintf("%s AS `%s`", s.Reference(), name) + } } // Name implementation of SConstField for IQueryField @@ -196,7 +201,12 @@ type SStringField struct { // Expression implementation of SStringField for IQueryField func (s *SStringField) Expression() string { - return fmt.Sprintf("%s AS `%s`", s.Reference(), s.Name()) + name := s.Name() + if len(name) == 0 { + return s.Reference() + } else { + return fmt.Sprintf("%s AS `%s`", s.Reference(), name) + } } // Name implementation of SStringField for IQueryField