application.go 1.0 KB

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