application.go 879 B

12345678910111213141516171819202122232425262728293031323334353637
  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. // App-Token for web hook
  13. AppToken string `sql:"type:varchar(200);not null;"`
  14. // Report Url for web hook
  15. ReportUrl string `sql:"type:varchar(200);not null;"`
  16. // name
  17. AppName string `sql:"type:varchar(200);"`
  18. // desc
  19. AppDescription string `sql:"type:text;"`
  20. // app domain which allows wildcard string like "*", "vendor/12", "product/10"
  21. AppDomain string `sql:"type:varchar(200);not null;"`
  22. // vendor id
  23. VendorID uint
  24. AppIcon string
  25. AppType string
  26. }
  27. // Validate 验证规则
  28. func (a *Application) Validate() error {
  29. if a.AppName == "" {
  30. return errors.New("非法参数:[AppName]")
  31. }
  32. return nil
  33. }