Update xorm to use the new import path (#133)
Fix ineffassign Fix getting all labels including the ones not associated to a task Signed-off-by: kolaente <k@knt.li> Fix logging sql queries Signed-off-by: kolaente <k@knt.li> Start fixing getting all labels Update xormigrate Update xorm to use the new import path Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/api/pulls/133
This commit is contained in:
61
vendor/xorm.io/builder/cond_and.go
generated
vendored
Normal file
61
vendor/xorm.io/builder/cond_and.go
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
// 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 condAnd []Cond
|
||||
|
||||
var _ Cond = condAnd{}
|
||||
|
||||
// And generates AND conditions
|
||||
func And(conds ...Cond) Cond {
|
||||
var result = make(condAnd, 0, len(conds))
|
||||
for _, cond := range conds {
|
||||
if cond == nil || !cond.IsValid() {
|
||||
continue
|
||||
}
|
||||
result = append(result, cond)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func (and condAnd) WriteTo(w Writer) error {
|
||||
for i, cond := range and {
|
||||
_, isOr := cond.(condOr)
|
||||
_, isExpr := cond.(expr)
|
||||
wrap := isOr || isExpr
|
||||
if wrap {
|
||||
fmt.Fprint(w, "(")
|
||||
}
|
||||
|
||||
err := cond.WriteTo(w)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if wrap {
|
||||
fmt.Fprint(w, ")")
|
||||
}
|
||||
|
||||
if i != len(and)-1 {
|
||||
fmt.Fprint(w, " AND ")
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (and condAnd) And(conds ...Cond) Cond {
|
||||
return And(and, And(conds...))
|
||||
}
|
||||
|
||||
func (and condAnd) Or(conds ...Cond) Cond {
|
||||
return Or(and, Or(conds...))
|
||||
}
|
||||
|
||||
func (and condAnd) IsValid() bool {
|
||||
return len(and) > 0
|
||||
}
|
Reference in New Issue
Block a user