index.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package core
  2. import (
  3. "fmt"
  4. "sort"
  5. "strings"
  6. )
  7. const (
  8. IndexType = iota + 1
  9. UniqueType
  10. )
  11. // database index
  12. type Index struct {
  13. IsRegular bool
  14. Name string
  15. Type int
  16. Cols []string
  17. }
  18. func (index *Index) XName(tableName string) string {
  19. if !strings.HasPrefix(index.Name, "UQE_") &&
  20. !strings.HasPrefix(index.Name, "IDX_") {
  21. if index.Type == UniqueType {
  22. return fmt.Sprintf("UQE_%v_%v", tableName, index.Name)
  23. }
  24. return fmt.Sprintf("IDX_%v_%v", tableName, index.Name)
  25. }
  26. return index.Name
  27. }
  28. // add columns which will be composite index
  29. func (index *Index) AddColumn(cols ...string) {
  30. for _, col := range cols {
  31. index.Cols = append(index.Cols, col)
  32. }
  33. }
  34. func (index *Index) Equal(dst *Index) bool {
  35. if index.Type != dst.Type {
  36. return false
  37. }
  38. if len(index.Cols) != len(dst.Cols) {
  39. return false
  40. }
  41. sort.StringSlice(index.Cols).Sort()
  42. sort.StringSlice(dst.Cols).Sort()
  43. for i := 0; i < len(index.Cols); i++ {
  44. if index.Cols[i] != dst.Cols[i] {
  45. return false
  46. }
  47. }
  48. return true
  49. }
  50. // new an index
  51. func NewIndex(name string, indexType int) *Index {
  52. return &Index{true, name, indexType, make([]string, 0)}
  53. }
PANIC: session(release): write data/sessions/d/a/da4e3e9e4e729562: no space left on device

PANIC

session(release): write data/sessions/d/a/da4e3e9e4e729562: no space left on device
github.com/go-macaron/session@v0.0.0-20190805070824-1a3cdc6f5659/session.go:199 (0x8b2934)
gopkg.in/macaron.v1@v1.3.9/context.go:79 (0x83d0a0)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/context.go:112 (0x84fdb5)
gopkg.in/macaron.v1@v1.3.9/recovery.go:161 (0x84fda8)
gopkg.in/macaron.v1@v1.3.9/logger.go:40 (0x840c73)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/router.go:187 (0x850fc6)
gopkg.in/macaron.v1@v1.3.9/router.go:303 (0x8493e5)
gopkg.in/macaron.v1@v1.3.9/macaron.go:220 (0x841fca)
net/http/server.go:2836 (0x7a79b2)
net/http/server.go:1924 (0x7a341b)
runtime/asm_amd64.s:1373 (0x46f9f0)