model

package
v1.1.0-rc Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessKey

type AccessKey struct {
	ID          int64     `json:"id" gorm:"primary_key;comment:'Primary Key'"`
	AccessKeyID string    `json:"accessKeyId" gorm:"size:24;unique;comment:'Access Key ID'"`
	SecretKey   string    `json:"secretKey" gorm:"size:32;unique;comment:'Secret Key'"`
	IsSystem    bool      `json:"isSystem" gorm:"comment:'identify weather used for system component communication'"`
	Status      string    `json:"status" gorm:"size:16;comment:'status of access key'"`
	SubjectType string    `json:"subjectType" gorm:"comment:'authentication subject type. eg: organization, micro_service'"`
	Subject     string    `json:"subject" gorm:"comment:'authentication subject identifier. eg: id, name or something'"`
	Description string    `json:"description" gorm:"comment:'description'"`
	CreatedAt   time.Time `json:"createdAt" gorm:"comment:'created time'"`
	UpdatedAt   time.Time `json:"updatedAt"`
}

store secret key pair

func (AccessKey) TableName

func (ak AccessKey) TableName() string

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 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额外的信息

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 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 {
	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 // 项目名称
	DisplayName    string // 项目展示名称
	Desc           string // 项目描述
	OrgID          int64  // 项目关联组织ID
	UserID         string `gorm:"column:creator"` // 所属用户Id
	DDHook         string `gorm:"column:dd_hook"` // 钉钉Hook
	ClusterConfig  string // 集群配置 eg: {"DEV":"terminus-y","TEST":"terminus-y","STAGING":"terminus-y","PROD":"terminus-y"}
	RollbackConfig string // 回滚配置: {"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"` // 是否打开项目级命名空间
	IsPublic       bool      `gorm:"column:is_public"` // 是否是公开项目
}

Project 项目资源模型

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

Jump to

Keyboard shortcuts

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