diff options
author | Unknwon <u@gogs.io> | 2019-10-23 23:03:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-23 23:03:17 -0700 |
commit | 613139e7bef81d3573e7988a47eb6765f3de347a (patch) | |
tree | 49de7277898d3ff47a122c072568edb8ed4c9ac9 /vendor/github.com/go-xorm/builder/cond_or.go | |
parent | fb100dbf98f02e4c631d142ff0f52ec29ee2f00c (diff) |
Enable Go modules (#5835)
* Remove vendor
* Enable Go modules
* ci: add command to fetch dependencies
* ci: update setting
* ci: update settings
* Require Go 1.11
* Rename module name to gogs.io/gogs
Diffstat (limited to 'vendor/github.com/go-xorm/builder/cond_or.go')
-rw-r--r-- | vendor/github.com/go-xorm/builder/cond_or.go | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/vendor/github.com/go-xorm/builder/cond_or.go b/vendor/github.com/go-xorm/builder/cond_or.go deleted file mode 100644 index 35c3da02..00000000 --- a/vendor/github.com/go-xorm/builder/cond_or.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2016 The Xorm Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package builder - -import "fmt" - -type condOr []Cond - -var _ Cond = condOr{} - -// Or sets OR conditions -func Or(conds ...Cond) Cond { - var result = make(condOr, 0, len(conds)) - for _, cond := range conds { - if cond == nil || !cond.IsValid() { - continue - } - result = append(result, cond) - } - return result -} - -// WriteTo implments Cond -func (o condOr) WriteTo(w Writer) error { - for i, cond := range o { - var needQuote bool - switch cond.(type) { - case condAnd: - needQuote = true - case Eq: - needQuote = (len(cond.(Eq)) > 1) - } - - if needQuote { - fmt.Fprint(w, "(") - } - - err := cond.WriteTo(w) - if err != nil { - return err - } - - if needQuote { - fmt.Fprint(w, ")") - } - - if i != len(o)-1 { - fmt.Fprint(w, " OR ") - } - } - - return nil -} - -func (o condOr) And(conds ...Cond) Cond { - return And(o, And(conds...)) -} - -func (o condOr) Or(conds ...Cond) Cond { - return Or(o, Or(conds...)) -} - -func (o condOr) IsValid() bool { - return len(o) > 0 -} |