From d67eeac5dd89ef88bb74a16f317807e3ecd881c1 Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Wed, 28 Oct 2020 14:21:05 +0800 Subject: [PATCH] vendor: bump yunion.io/x/sqlchemy --- go.mod | 2 +- go.sum | 2 ++ vendor/modules.txt | 2 +- vendor/yunion.io/x/sqlchemy/conditions.go | 20 ++++++++++++++++++++ vendor/yunion.io/x/sqlchemy/filter.go | 8 ++++++++ 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 2167545788..6f427706d0 100644 --- a/go.mod +++ b/go.mod @@ -146,7 +146,7 @@ require ( yunion.io/x/ovsdb v0.0.0-20200526071744-27bf0940cbc7 yunion.io/x/pkg v0.0.0-20201028134817-3ed15ee169bc yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e - yunion.io/x/sqlchemy v0.0.0-20201029091740-cd5e77b56d4b + yunion.io/x/sqlchemy v0.0.0-20201116041103-013e56cab959 yunion.io/x/structarg v0.0.0-20200720093445-9f850fa222ce ) diff --git a/go.sum b/go.sum index 903d69a053..ad0e2059c0 100644 --- a/go.sum +++ b/go.sum @@ -1142,5 +1142,7 @@ yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e h1:v+EzIadodSwkdZ/7bremd7J8 yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e/go.mod h1:0iFKpOs1y4lbCxeOmq3Xx/0AcQoewVPwj62eRluioEo= yunion.io/x/sqlchemy v0.0.0-20201029091740-cd5e77b56d4b h1:xBAzDPvvmsOBjxAj0PLHMNLVdPNOlYFHAm7T3IZ2ehs= yunion.io/x/sqlchemy v0.0.0-20201029091740-cd5e77b56d4b/go.mod h1:FTdwPdGhMgh4E+UFXc9klI1Ok34fMuybTT+jLhOaIjI= +yunion.io/x/sqlchemy v0.0.0-20201116041103-013e56cab959 h1:42hMtiEXrGgSf2aS+LE5FNK9i3FzKwyaPgYoX0rD6NQ= +yunion.io/x/sqlchemy v0.0.0-20201116041103-013e56cab959/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 8f771f9c76..313dcd6515 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1110,7 +1110,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-20201029091740-cd5e77b56d4b +# yunion.io/x/sqlchemy v0.0.0-20201116041103-013e56cab959 yunion.io/x/sqlchemy # yunion.io/x/structarg v0.0.0-20200720093445-9f850fa222ce yunion.io/x/structarg diff --git a/vendor/yunion.io/x/sqlchemy/conditions.go b/vendor/yunion.io/x/sqlchemy/conditions.go index 89524f0e8f..cd317641c3 100644 --- a/vendor/yunion.io/x/sqlchemy/conditions.go +++ b/vendor/yunion.io/x/sqlchemy/conditions.go @@ -514,3 +514,23 @@ func Between(f IQueryField, r1, r2 interface{}) ICondition { c := SBetweenCondition{NewTripleCondition(f, r1, r2)} return &c } + +type STrueCondition struct{} + +func (t *STrueCondition) WhereClause() string { + return "1" +} + +func (t *STrueCondition) Variables() []interface{} { + return nil +} + +type SFalseCondition struct{} + +func (t *SFalseCondition) WhereClause() string { + return "0" +} + +func (t *SFalseCondition) Variables() []interface{} { + return nil +} diff --git a/vendor/yunion.io/x/sqlchemy/filter.go b/vendor/yunion.io/x/sqlchemy/filter.go index f387df5d2e..b8c329d4e4 100644 --- a/vendor/yunion.io/x/sqlchemy/filter.go +++ b/vendor/yunion.io/x/sqlchemy/filter.go @@ -31,6 +31,14 @@ func (tq *SQuery) Filter(cond ICondition) *SQuery { return tq } +func (tq *SQuery) FilterByTrue() *SQuery { + return tq.Filter(&STrueCondition{}) +} + +func (tq *SQuery) FilterByFalse() *SQuery { + return tq.Filter(&SFalseCondition{}) +} + func (q *SQuery) Like(f string, v string) *SQuery { cond := Like(q.Field(f), v) return q.Filter(cond)