THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

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.

36 lines
594B

  1. // Copyright 2019 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 xorm
  5. import "strings"
  6. type columnMap []string
  7. func (m columnMap) contain(colName string) bool {
  8. if len(m) == 0 {
  9. return false
  10. }
  11. n := len(colName)
  12. for _, mk := range m {
  13. if len(mk) != n {
  14. continue
  15. }
  16. if strings.EqualFold(mk, colName) {
  17. return true
  18. }
  19. }
  20. return false
  21. }
  22. func (m *columnMap) add(colName string) bool {
  23. if m.contain(colName) {
  24. return false
  25. }
  26. *m = append(*m, colName)
  27. return true
  28. }