12345678910111213141516171819202122232425262728293031323334353637383940 |
- package models
- import (
- "errors"
- "github.com/jinzhu/gorm"
- )
- // Application 代指一个应用程序
- // application is app who will use the cloud api
- type Application struct {
- gorm.Model
- RecordId string `gorm:"column:record_id;size:32;index"`
- // App-Key for api
- AppKey string `sql:"type:varchar(200);not null;"`
- //Secret-Key
- SecretKey string `sql:"type:varchar(200);not null;"`
- // App-Token for web hook
- AppToken string `sql:"type:varchar(200);not null;"`
- // Report Url for web hook
- ReportUrl string `sql:"type:varchar(200);not null;"`
- // name
- AppName string `sql:"type:varchar(200);"`
- // desc
- AppDescription string `sql:"type:text;"`
- // app domain which allows wildcard string like "*", "vendor/12", "product/10"
- AppDomain string `sql:"type:varchar(200);not null;"`
- // vendor id
- VendorID string `gorm:"column:vendor_id;index;size:32"`
- AppIcon string
- AppType string
- }
- // Validate 验证规则
- func (a *Application) Validate() error {
- if a.AppName == "" {
- return errors.New("非法参数:[AppName]")
- }
- return nil
- }
|