model

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const TableNotifyChannel = "erda_notify_channel"

Variables

This section is empty.

Functions

This section is empty.

Types

type Activity

type Activity struct {
	BaseModel
	OrgID         int64
	ProjectID     int64
	ApplicationID int64
	BuildID       int64
	RuntimeID     int64
	UserID        string `gorm:"column:operator"`
	Type          string // 活动类型
	Action        string
	Desc          string // 活动描述
	Context       string `json:"context" gorm:"type:text"`
}

Activity 活动模型

func (Activity) TableName

func (Activity) TableName() string

TableName 设置模型对应数据库表名称

type Application

type Application struct {
	BaseModel
	Name           string // 应用名称
	DisplayName    string // 应用展示名称
	Desc           string // 应用描述
	Config         string // 钉钉配置
	ProjectID      int64  `gorm:"index:idx_project_id"` // 应用关联项目Id
	ProjectName    string // 应用关联项目名称
	OrgID          int64  // 应用关联组织Id
	Mode           string // 应用模式
	Pined          bool   `gorm:"-"` // 应用是否pined
	GitRepo        string
	GitRepoAbbrev  string
	IsExternalRepo bool
	UnblockStart   *time.Time // 解封开始时间
	UnblockEnd     *time.Time // 解封结束时间
	RepoConfig     string
	UserID         string `gorm:"column:creator"` // 所属用户Id
	Extra          string // 应用配置namespace等
	IsPublic       bool   // 应用是否公开
}

Application 应用资源模型

func (Application) TableName

func (Application) TableName() string

TableName 设置模型对应数据库表名称

type ApplicationPublishItemRelation

type ApplicationPublishItemRelation struct {
	BaseModel
	AppID         int64
	PublishItemID int64
	Env           apistructs.DiceWorkspace
	Creator       string
	AK            string
	AI            string
}

ApplicationPublishItemRelation 应用和发布项关联关系

func (ApplicationPublishItemRelation) TableName

TableName 设置模型对应数据库表名称

type Approve

type Approve struct {
	BaseModel
	OrgID        uint64
	TargetID     uint64
	EntityID     uint64
	TargetName   string
	Extra        string
	Title        string
	Priority     string
	Status       string
	Submitter    string
	Approver     string
	Type         string // IOS发布证书/Android证书/消息推送证书
	Desc         string
	ApprovalTime *time.Time
}

Approve 审批信息模型

func (Approve) TableName

func (Approve) TableName() string

TableName 设置模型对应数据库表名称

type Audit

type Audit struct {
	BaseModel
	StartTime    time.Time               `gorm:"column:start_time"`
	EndTime      time.Time               `gorm:"column:end_time"`
	UserID       string                  `gorm:"column:user_id"`
	ScopeType    apistructs.ScopeType    `gorm:"column:scope_type"`
	ScopeID      uint64                  `gorm:"column:scope_id"`
	FDPProjectID string                  `gorm:"column:fdp_project_id"`
	AppID        uint64                  `gorm:"column:app_id"`
	ProjectID    uint64                  `gorm:"column:project_id"`
	OrgID        uint64                  `gorm:"column:org_id"`
	Context      string                  `gorm:"column:context"`
	TemplateName apistructs.TemplateName `gorm:"column:template_name"`
	AuditLevel   string                  `gorm:"column:audit_level"`
	Result       apistructs.Result       `gorm:"column:result"`
	ErrorMsg     string                  `gorm:"column:error_msg"`
	ClientIP     string                  `gorm:"column:client_ip"`
	UserAgent    string                  `gorm:"column:user_agent"`
	Deleted      int                     `gorm:"column:deleted"`
}

Audit 审计事件

func (Audit) TableName

func (Audit) TableName() string

TableName 设置模型对应数据库表名称

type AuditSettings

type AuditSettings struct {
	ID     uint64
	Config OrgConfig
}

AuditSettings 审计事件的清理周期设置

type BaseModel

type BaseModel struct {
	ID        int64     `json:"id" gorm:"primary_key"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

BaseModel common info for all models

type BlockoutConfig

type BlockoutConfig struct {
	BlockDEV   bool `json:"blockDev"`
	BlockTEST  bool `json:"blockTest"`
	BlockStage bool `json:"blockStage"`
	BlockProd  bool `json:"blockProd"`
}

func (*BlockoutConfig) Scan

func (cfg *BlockoutConfig) Scan(value interface{}) error

func (BlockoutConfig) Value

func (cfg BlockoutConfig) Value() (driver.Value, error)

type Config added in v1.3.0

type Config struct {
	HashedPassword string `json:"hashed_password"`
}

type CurrentOrg

type CurrentOrg struct {
	BaseModel
	UserID string
	OrgID  int64
}

CurrentOrg 用户当前所属企业

func (CurrentOrg) TableName

func (CurrentOrg) TableName() string

TableName 设置模型对应数据库表名称

type ErrorLog

type ErrorLog struct {
	BaseModel
	ResourceType   apistructs.ErrorResourceType `gorm:"column:resource_type"`
	ResourceID     string                       `gorm:"column:resource_id"`
	Level          apistructs.ErrorLogLevel     `gorm:"column:level"`
	OccurrenceTime time.Time                    `gorm:"column:occurrence_time"`
	HumanLog       string                       `gorm:"column:human_log"`
	PrimevalLog    string                       `gorm:"column:primeval_log"`
	DedupID        string                       `gorm:"column:dedup_id"`
}

ErrorLog 错误日志模型

func (ErrorLog) TableName

func (ErrorLog) TableName() string

TableName 设置模型对应数据库表名称

type FavoritedResource

type FavoritedResource struct {
	BaseModel
	Target   string // 被收藏的资源类型: app/project, etc
	TargetID uint64
	UserID   string
}

FavoritedResource 收藏的资源

type MBox

type MBox struct {
	BaseModel
	Title   string
	Content string
	Label   string //站内信所属模块  monitor|pipeline
	UserID  string
	Status  apistructs.MBoxStatus //read|unread
	OrgID   int64
	ReadAt  *time.Time
	// The UnreadCount not empty only when DeduplicateID isn't empty
	DeduplicateID string `gorm:"column:deduplicate_id"`
	UnreadCount   int64  `gorm:"column:unread_count"`
}

func (MBox) TableName

func (MBox) TableName() string

func (MBox) ToApiData

func (mbox MBox) ToApiData() *apistructs.MBox

type ManualReview

type ManualReview struct {
	BaseModel
	BuildId         int    `gorm:"build_id"`
	ProjectId       int    `gorm:"project_id"`
	ApplicationId   int    `gorm:"application_id"`
	ApplicationName string `gorm:"application_name"`
	SponsorId       string `gorm:"sponsor_id"`
	CommitID        string `gorm:"commit_id"`
	OrgId           int64  `gorm:"org_id"`
	TaskId          int    `gorm:"task_id"`
	ProjectName     string `gorm:"project_name"`
	BranchName      string `gorm:"branch_name"`
	ApprovalStatus  string `gorm:"approval_status"`
	CommitMessage   string `gorm:"commit_message"`
	ApprovalReason  string `gorm:"approval_reason"`
}

type Member

type Member struct {
	BaseModel
	ScopeType     apistructs.ScopeType // 系统管理员(sys)/企业(org)/项目(project)/应用(app)
	ScopeID       int64                // 企业ID/项目ID/应用ID
	ScopeName     string               // 企业/项目/应用名称
	ParentID      int64
	UserID        string
	Email         string    // 用户邮箱
	Mobile        string    // 用户手机号
	Name          string    // 用户名
	Nick          string    // 用户昵称
	Avatar        string    // 用户头像
	Token         string    // 用户鉴权token
	UserSyncAt    time.Time // 用户信息同步时间
	OrgID         int64     // 冗余 OrgID,方便用于退出企业时删除所有企业相关 member
	ProjectID     int64     // 冗余 ProjectID,方便用户退出项目时删除所有项目相关 member
	ApplicationID int64     // 冗余 AppID,目前等价于 scopeType=app & scopeID=appID
	Roles         []string  `gorm:"-"` // Manager/Developer/Tester
	Labels        []string  `gorm:"-"` // 不是表字段,用来记录join表后返回的标签字段。
	Deleted       bool      `gorm:"-"` // 不是表字段,用来过滤uc已删除的用户
}

Member 企业/项目/应用三级关系成员信息(包含平台管理员)

func (*Member) Convert2APIDTO

func (m *Member) Convert2APIDTO() apistructs.Member

func (Member) TableName

func (Member) TableName() string

TableName 设置模型对应数据库表名称

type MemberExtra

type MemberExtra struct {
	BaseModel
	// UeserID 关联成员的用户id
	UserID string `gorm:"column:user_id"`
	// ParentID 成员的父scope_id
	ParentID int64 `gorm:"column:parent_id"`
	// ScopeType 关联成员的scope_type
	ScopeType apistructs.ScopeType `gorm:"column:scope_type"`
	// ScopeID 关联成员的scope_id
	ScopeID int64 `gorm:"column:scope_id"`
	// ResourceKey 关联资源的key
	ResourceKey apistructs.ExtraResourceKey `gorm:"column:resource_key"`
	// ResourceValue 管理资源的值
	ResourceValue string `gorm:"column:resource_value"`
}

func (MemberExtra) TableName

func (MemberExtra) TableName() string

TableName 表名

type MemberJoin

type MemberJoin struct {
	Member
	ResourceKey   apistructs.ExtraResourceKey `gorm:"column:resource_key"`
	ResourceValue string                      `gorm:"column:resource_value"`
}

MemberJoin 用于和 memberExtra 连表查询获取member额外的信息

func (*MemberJoin) Convert2APIDTO added in v1.3.0

func (m *MemberJoin) Convert2APIDTO() apistructs.Member

type Notify

type Notify struct {
	BaseModel
	Name          string `gorm:"size:150"`
	ScopeType     string `gorm:"size:150;index:idx_scope_type"`
	ScopeID       string `gorm:"size:150;index:idx_scope_id"`
	Label         string `gorm:"size:150"`
	ClusterName   string
	Channels      string `gorm:"type:text"`
	NotifyGroupID int64  `gorm:"index:notify_group_id"`
	OrgID         int64  `gorm:"index:idx_org_id"`
	Creator       string
	Enabled       bool
	Data          string `gorm:"type:text"`
}

func (Notify) TableName

func (Notify) TableName() string

TableName 设置模型对应数据库表名称

type NotifyChannel added in v1.5.0

type NotifyChannel struct {
	Id              string    `gorm:"column:id" db:"id" json:"id" form:"id"`                                                         //id
	Name            string    `gorm:"column:name" db:"name" json:"name" form:"name"`                                                 //渠道名称
	Type            string    `gorm:"column:type" db:"type" json:"type" form:"type"`                                                 //渠道类型
	Config          string    `gorm:"column:config" db:"config" json:"config" form:"config"`                                         //渠道配置
	ScopeType       string    `gorm:"column:scope_type" db:"scope_type" json:"scope_type" form:"scope_type"`                         //域类型
	ScopeId         string    `gorm:"column:scope_id" db:"scope_id" json:"scope_id" form:"scope_id"`                                 //域id
	CreatorId       string    `gorm:"column:creator_id" db:"creator_id" json:"creator_id" form:"creator_id"`                         //创建人Id
	ChannelProvider string    `gorm:"column:channel_provider" db:"channel_provider" json:"channel_provider" form:"channel_provider"` //渠道提供商类型
	IsEnabled       bool      `gorm:"column:is_enabled" db:"is_enabled" json:"is_enabled" form:"is_enabled"`                         //是否启用
	KmsKey          string    `gorm:"column:kms_key" db:"kms_key" json:"kms_key" form:"kms_key"`                                     //kms key
	CreatedAt       time.Time `gorm:"column:created_at" db:"created_at" json:"created_at" form:"created_at"`                         //创建时间
	UpdatedAt       time.Time `gorm:"column:updated_at" db:"updated_at" json:"updated_at" form:"updated_at"`                         //更新时间
	IsDeleted       bool      `gorm:"column:is_deleted" db:"is_deleted" json:"is_deleted" form:"is_deleted"`                         //是否删除
}

func (NotifyChannel) TableName added in v1.5.0

func (NotifyChannel) TableName() string

type NotifyGroup

type NotifyGroup struct {
	BaseModel
	Name        string `gorm:"size:150"`
	ScopeType   string `gorm:"size:150;index:idx_scope_type"`
	ScopeID     string `gorm:"size:150;index:idx_scope_id"`
	OrgID       int64  `gorm:"index:idx_org_id"`
	TargetData  string `gorm:"type:text"`
	Label       string `gorm:"size:200"`
	ClusterName string
	AutoCreate  bool
	Creator     string `gorm:"size:150"`
}

func (NotifyGroup) TableName

func (NotifyGroup) TableName() string

func (*NotifyGroup) ToApiData

func (notifyGroup *NotifyGroup) ToApiData() *apistructs.NotifyGroup

type NotifyHistory

type NotifyHistory struct {
	BaseModel
	NotifyName            string `gorm:"size:150;index:idx_notify_name"`
	NotifyItemDisplayName string `gorm:"size:150"`
	Channel               string `gorm:"size:150"`
	TargetData            string `gorm:"type:text"`
	SourceData            string `gorm:"type:text"`
	Status                string `gorm:"size:150"`
	OrgID                 int64  `gorm:"index:idx_org_id"`
	SourceType            string `gorm:"size:150"`
	SourceID              string `gorm:"size:150"`
	ErrorMsg              string `gorm:"type:text"`
	// 模块类型 cdp/workbench/monitor
	Label       string `gorm:"size:150;index:idx_module"`
	ClusterName string
}

func (NotifyHistory) TableName

func (NotifyHistory) TableName() string

TableName 设置模型对应数据库表名称

func (*NotifyHistory) ToApiData

func (notifyHistory *NotifyHistory) ToApiData() *apistructs.NotifyHistory

type NotifyItem

type NotifyItem struct {
	BaseModel
	Name             string `gorm:"size:150"`
	DisplayName      string `gorm:"size:150"`
	Category         string `gorm:"size:150"`
	MobileTemplate   string `gorm:"type:text"`
	EmailTemplate    string `gorm:"type:text"`
	DingdingTemplate string `gorm:"type:text"`
	MBoxTemplate     string `gorm:"type:text;column:mbox_template"`
	// 语音通知模版
	VMSTemplate string `gorm:"type:text;column:vms_template"`
	// 语音通知的被叫显号,语音模版属于公共号码池外呼的时候,被叫显号必须是空
	// 属于专属号码外呼的时候,被叫显号不能为空
	CalledShowNumber string `gorm:"size:150;column:called_show_number"`
	ScopeType        string `gorm:"size:150"`
	Label            string `gorm:"size:150"`
	Params           string `gorm:"type:text"`
}

func (NotifyItem) TableName

func (NotifyItem) TableName() string

func (*NotifyItem) ToApiData

func (notifyItem *NotifyItem) ToApiData() *apistructs.NotifyItem

type NotifyItemRelation

type NotifyItemRelation struct {
	BaseModel
	NotifyID     int64 `gorm:"index:notify_id"`
	NotifyItemID int64 `gorm:"index:notify_item_id"`
}

func (NotifyItemRelation) TableName

func (NotifyItemRelation) TableName() string

TableName 设置模型对应数据库表名称

type NotifySource

type NotifySource struct {
	BaseModel
	Name       string `gorm:"size:150"`
	NotifyID   int64  `gorm:"index:notify_id"`
	SourceType string `gorm:"index:source_type"`
	SourceID   string `gorm:"index:source_id"`
	OrgID      int64
}

func (NotifySource) TableName

func (NotifySource) TableName() string

TableName 设置模型对应数据库表名称

type Org

type Org struct {
	BaseModel
	Name           string
	DisplayName    string
	Desc           string
	Locale         string
	OpenFdp        bool   `json:"openFdp"`
	UserID         string `gorm:"column:creator"` // 所属用户Id
	Config         OrgConfig
	BlockoutConfig BlockoutConfig
	Type           string
	Status         string // TODO deprecated 待admin下线后删除
	IsPublic       bool
}

Org 企业资源模型

func (Org) TableName

func (Org) TableName() string

TableName 设置模型对应数据库表名称

type OrgClusterRelation

type OrgClusterRelation struct {
	BaseModel
	OrgID       uint64 `gorm:"unique_index:idx_org_cluster_id"`
	OrgName     string
	ClusterID   uint64 `gorm:"unique_index:idx_org_cluster_id"`
	ClusterName string
	Creator     string
}

OrgClusterRelation 企业集群关联关系

func (OrgClusterRelation) TableName

func (OrgClusterRelation) TableName() string

TableName 设置模型对应数据库表名称

type OrgConfig

type OrgConfig struct {
	EnablePersonalMessageEmail bool   `json:"enablePersonalMessageEmail"`
	EnableMS                   bool   `json:"enableMs"`
	SMTPHost                   string `json:"smtpHost"`
	SMTPUser                   string `json:"smtpUser"`
	SMTPPassword               string `json:"smtpPassword"`
	SMTPPort                   int64  `json:"smtpPort"`
	SMTPIsSSL                  bool   `json:"smtpIsSSL"`
	SMSKeyID                   string `json:"smsKeyID"`
	SMSKeySecret               string `json:"smsKeySecret"`
	SMSSignName                string `json:"smsSignName"`
	SMSMonitorTemplateCode     string `json:"smsMonitorTemplateCode"` // 监控单独的短信模版
	VMSKeyID                   string `json:"vmsKeyID"`
	VMSKeySecret               string `json:"vmsKeySecret"`
	VMSMonitorTtsCode          string `json:"vmsMonitorTtsCode"`          // 监控单独的语音模版
	VMSMonitorCalledShowNumber string `json:"vmsMonitorCalledShowNumber"` // 监控单独的被叫显号
	AuditInterval              int64  `json:"auditInterval"`

	// 开关:制品是否可以跨集群部署
	EnableReleaseCrossCluster bool `json:"enableReleaseCrossCluster"`
}

func (*OrgConfig) Scan

func (cfg *OrgConfig) Scan(value interface{}) error

func (OrgConfig) Value

func (cfg OrgConfig) Value() (driver.Value, error)

type Project

type Project struct {
	BaseModel
	Name           string // Project name
	DisplayName    string // Project display name
	Desc           string // Project description
	OrgID          int64  // Project related organization ID
	UserID         string `gorm:"column:creator"` // 所属用户Id
	DDHook         string `gorm:"column:dd_hook"` // 钉钉Hook
	ClusterConfig  string // Cluster configuration eg: {"DEV":"terminus-y","TEST":"terminus-y","STAGING":"terminus-y","PROD":"terminus-y"}
	RollbackConfig string // Rollback configuration: {"DEV": 1,"TEST": 2,"STAGING": 3,"PROD": 4}
	CpuQuota       float64
	MemQuota       float64
	Functions      string    `gorm:"column:functions"`
	ActiveTime     time.Time `gorm:"column:active_time"`
	EnableNS       bool      `gorm:"column:enable_ns"` // Whether to open the project-level namespace
	IsPublic       bool      `gorm:"column:is_public"` // Is it a public project
	Type           string    `gorm:"column:type"`      // project type

	Quota *apistructs.ProjectQuota `json:"quota,omitempty" gorm:"-"`
}

Project 项目资源模型

func (*Project) GetClusterConfig added in v1.5.0

func (p *Project) GetClusterConfig() map[string]string

func (Project) TableName

func (Project) TableName() string

TableName 设置模型对应数据库表名称

type ReviewUser

type ReviewUser struct {
	BaseModel
	Operator string `gorm:"operator"`
	OrgId    int64  `gorm:"org_id"`
	TaskId   int64  `gorm:"task_id"`
}

type RolePermission

type RolePermission struct {
	dbengine.BaseModel
	Scope        string `gorm:"type:varchar(30);unique_index:idx_resource_action" yaml:"scope"`
	Role         string `gorm:"type:varchar(30);unique_index:idx_resource_action" yaml:"role"`
	ResourceRole string `gorm:"type:varchar(30);unique_index:idx_resource_action" yaml:"resource_role"`
	Resource     string `gorm:"type:varchar(40);unique_index:idx_resource_action" yaml:"resource"`
	Action       string `gorm:"type:varchar(30);unique_index:idx_resource_action" yaml:"action"`
	Creator      string
}

RolePermission 角色资源操作

func (RolePermission) TableName

func (RolePermission) TableName() string

type Subscribe added in v1.5.0

type Subscribe struct {
	dbengine.BaseModel

	Type   string
	TypeID uint64
	Name   string
	UserID string
}

Subscribe manage erda item (project/application) subscribe

func (Subscribe) TableName added in v1.5.0

func (Subscribe) TableName() string

type User added in v1.3.0

type User struct {
	BaseModel
	Avatar   string
	Username string
	Nickname string
	Mobile   string
	Email    string
	Password string
}

type UserIDMapping added in v1.3.0

type UserIDMapping struct {
	ID     string
	UserID string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL