application.go 947 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package models
  2. import (
  3. "errors"
  4. "github.com/jinzhu/gorm"
  5. )
  6. // Application 代指一个应用程序
  7. // application is app who will use the cloud api
  8. type Application struct {
  9. gorm.Model
  10. // App-Key for api
  11. AppKey string `sql:"type:varchar(200);not null;"`
  12. //Secret-Key
  13. SecretKey string `sql:"type:varchar(200);not null;"`
  14. // App-Token for web hook
  15. AppToken string `sql:"type:varchar(200);not null;"`
  16. // Report Url for web hook
  17. ReportUrl string `sql:"type:varchar(200);not null;"`
  18. // name
  19. AppName string `sql:"type:varchar(200);"`
  20. // desc
  21. AppDescription string `sql:"type:text;"`
  22. // app domain which allows wildcard string like "*", "vendor/12", "product/10"
  23. AppDomain string `sql:"type:varchar(200);not null;"`
  24. // vendor id
  25. VendorID uint
  26. AppIcon string
  27. AppType string
  28. }
  29. // Validate 验证规则
  30. func (a *Application) Validate() error {
  31. if a.AppName == "" {
  32. return errors.New("非法参数:[AppName]")
  33. }
  34. return nil
  35. }