You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cond.go 685B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2016 The Xorm Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package builder
  5. // Cond defines an interface
  6. type Cond interface {
  7. WriteTo(Writer) error
  8. And(...Cond) Cond
  9. Or(...Cond) Cond
  10. IsValid() bool
  11. }
  12. type condEmpty struct{}
  13. var _ Cond = condEmpty{}
  14. // NewCond creates an empty condition
  15. func NewCond() Cond {
  16. return condEmpty{}
  17. }
  18. func (condEmpty) WriteTo(w Writer) error {
  19. return nil
  20. }
  21. func (condEmpty) And(conds ...Cond) Cond {
  22. return And(conds...)
  23. }
  24. func (condEmpty) Or(conds ...Cond) Cond {
  25. return Or(conds...)
  26. }
  27. func (condEmpty) IsValid() bool {
  28. return false
  29. }