setting.go 906 B

123456789101112131415161718192021222324252627282930313233
  1. package model
  2. const (
  3. SINGLE = iota
  4. SITE
  5. STYLE
  6. PREVIEW
  7. GLOBAL
  8. ARIA2
  9. INDEX
  10. GITHUB
  11. )
  12. const (
  13. PUBLIC = iota
  14. PRIVATE
  15. READONLY
  16. DEPRECATED
  17. )
  18. type SettingItem struct {
  19. Key string `json:"key" gorm:"primaryKey" binding:"required"` // unique key
  20. Value string `json:"value"` // value
  21. Help string `json:"help"` // help message
  22. Type string `json:"type"` // string, number, bool, select
  23. Options string `json:"options"` // values for select
  24. Group int `json:"group"` // use to group setting in frontend
  25. Flag int `json:"flag"` // 0 = public, 1 = private, 2 = readonly, 3 = deprecated, etc.
  26. }
  27. func (s SettingItem) IsDeprecated() bool {
  28. return s.Flag == DEPRECATED
  29. }