application.go 845 B

1234567891011121314151617181920212223242526272829303132333435
  1. // application is app who will use the cloud api
  2. package models
  3. import (
  4. "errors"
  5. "github.com/jinzhu/gorm"
  6. )
  7. // Application 代指一个应用程序
  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. }
  25. // Validate 验证规则
  26. func (a *Application) Validate() error {
  27. if a.AppName == "" {
  28. return errors.New("非法参数:[AppName]")
  29. }
  30. return nil
  31. }