2020-09-17 15:45:46 +08:00
|
|
|
package model
|
|
|
|
|
2020-10-07 22:00:55 +08:00
|
|
|
const (
|
|
|
|
// GovernanceModeBuildInServiceMesh means the governance mode is BUILD_IN_SERVICE_MESH
|
2020-11-07 10:11:33 +08:00
|
|
|
GovernanceModeBuildInServiceMesh = "BUILD_IN_SERVICE_MESH"
|
2020-10-07 22:00:55 +08:00
|
|
|
// GovernanceModeKubernetesNativeService means the governance mode is KUBERNETES_NATIVE_SERVICE
|
2020-11-07 10:11:33 +08:00
|
|
|
GovernanceModeKubernetesNativeService = "KUBERNETES_NATIVE_SERVICE"
|
2020-10-07 22:00:55 +08:00
|
|
|
)
|
|
|
|
|
2020-11-07 10:11:33 +08:00
|
|
|
// IsGovernanceModeValid checks if the governanceMode is valid.
|
|
|
|
func IsGovernanceModeValid(governanceMode string) bool {
|
|
|
|
return governanceMode == GovernanceModeBuildInServiceMesh || governanceMode == GovernanceModeKubernetesNativeService
|
|
|
|
}
|
|
|
|
|
2020-09-17 15:45:46 +08:00
|
|
|
// Application -
|
|
|
|
type Application struct {
|
|
|
|
Model
|
2020-10-07 22:00:55 +08:00
|
|
|
AppName string `gorm:"column:app_name" json:"app_name"`
|
|
|
|
AppID string `gorm:"column:app_id" json:"app_id"`
|
|
|
|
TenantID string `gorm:"column:tenant_id" json:"tenant_id"`
|
2020-11-07 10:11:33 +08:00
|
|
|
GovernanceMode string `gorm:"column:governance_mode;default:'BUILD_IN_SERVICE_MESH'" json:"governance_mode"`
|
2020-09-17 15:45:46 +08:00
|
|
|
}
|
|
|
|
|
2020-09-21 13:58:08 +08:00
|
|
|
// TableName return tableName "application"
|
2020-09-17 15:45:46 +08:00
|
|
|
func (t *Application) TableName() string {
|
2020-10-07 22:00:55 +08:00
|
|
|
return "applications"
|
2020-09-17 15:45:46 +08:00
|
|
|
}
|
2020-09-21 18:33:10 +08:00
|
|
|
|
2020-09-22 14:37:52 +08:00
|
|
|
// ServiceConfigGroup -
|
|
|
|
type ServiceConfigGroup struct {
|
|
|
|
Model
|
2020-09-23 14:48:53 +08:00
|
|
|
AppID string `gorm:"column:app_id" json:"-"`
|
|
|
|
ConfigGroupName string `gorm:"column:config_group_name" json:"-"`
|
2020-09-22 14:37:52 +08:00
|
|
|
ServiceID string `gorm:"column:service_id" json:"service_id"`
|
2020-09-23 14:48:53 +08:00
|
|
|
ServiceAlias string `gorm:"column:service_alias" json:"service_alias"`
|
2020-09-22 14:37:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// TableName return tableName "application"
|
|
|
|
func (t *ServiceConfigGroup) TableName() string {
|
2020-09-23 14:48:53 +08:00
|
|
|
return "app_config_group_service"
|
2020-09-22 14:37:52 +08:00
|
|
|
}
|
|
|
|
|
2020-10-08 16:10:03 +08:00
|
|
|
// ConfigGroupItem -
|
|
|
|
type ConfigGroupItem struct {
|
2020-09-22 14:37:52 +08:00
|
|
|
Model
|
2020-09-24 10:05:54 +08:00
|
|
|
AppID string `gorm:"column:app_id" json:"-"`
|
|
|
|
ConfigGroupName string `gorm:"column:config_group_name" json:"-"`
|
2020-09-22 14:37:52 +08:00
|
|
|
ItemKey string `gorm:"column:item_key" json:"item_key"`
|
|
|
|
ItemValue string `gorm:"column:item_value" json:"item_value"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// TableName return tableName "application"
|
2020-10-08 16:10:03 +08:00
|
|
|
func (t *ConfigGroupItem) TableName() string {
|
2020-09-23 14:48:53 +08:00
|
|
|
return "app_config_group_item"
|
2020-09-21 18:33:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// ApplicationConfigGroup -
|
|
|
|
type ApplicationConfigGroup struct {
|
|
|
|
Model
|
2020-09-22 14:37:52 +08:00
|
|
|
AppID string `gorm:"column:app_id" json:"app_id"`
|
|
|
|
ConfigGroupName string `gorm:"column:config_group_name" json:"config_group_name"`
|
|
|
|
DeployType string `gorm:"column:deploy_type;default:'env'" json:"deploy_type"`
|
2020-09-21 18:33:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// TableName return tableName "application"
|
|
|
|
func (t *ApplicationConfigGroup) TableName() string {
|
2020-09-23 14:48:53 +08:00
|
|
|
return "app_config_group"
|
2020-09-21 18:33:10 +08:00
|
|
|
}
|