db

package
v1.3.0-rc.0...-0a48220 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFoundOrg = errors.New("org not found")
)

Functions

This section is empty.

Types

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 DBClient

type DBClient struct {
	*dao.DBClient
}

func (*DBClient) CreateOrg

func (client *DBClient) CreateOrg(org *Org) error

CreateOrg 创建企业

func (*DBClient) CreateOrgClusterRelation

func (client *DBClient) CreateOrgClusterRelation(relation *OrgClusterRelation) error

CreateOrgClusterRelation 创建企业集群关系

func (*DBClient) DeleteOrg

func (client *DBClient) DeleteOrg(orgID int64) error

DeleteOrg 删除企业

func (*DBClient) DeleteOrgClusterRelationByCluster

func (client *DBClient) DeleteOrgClusterRelationByCluster(clusterName string) error

DeleteOrgClusterRelationByCluster 根据 clusterName 删除企业集群关联关系

func (*DBClient) DeleteOrgClusterRelationByClusterAndOrg

func (client *DBClient) DeleteOrgClusterRelationByClusterAndOrg(clusterName string, orgID int64) error

DeleteOrgClusterRelationByClusterAndOrg 根据 clusterName、orgID 删除企业集群关联关系

func (*DBClient) GetOrg

func (client *DBClient) GetOrg(orgID int64) (Org, error)

GetOrg 根据orgID获取企业信息

func (*DBClient) GetOrgByName

func (client *DBClient) GetOrgByName(orgName string) (*Org, error)

GetOrgByName 根据 orgName 获取企业信息

func (*DBClient) GetOrgClusterRelationByOrgAndCluster

func (client *DBClient) GetOrgClusterRelationByOrgAndCluster(orgID, clusterID int64) (*OrgClusterRelation, error)

GetOrgClusterRelationByOrgAndCluster 获取企业集群关系

func (*DBClient) GetOrgClusterRelationsByCluster

func (client *DBClient) GetOrgClusterRelationsByCluster(clusterName string) ([]OrgClusterRelation, error)

GetOrgClusterRelationsByCluster 根据 cluster_name 获取企业对应集群关系

func (*DBClient) GetOrgClusterRelationsByOrg

func (client *DBClient) GetOrgClusterRelationsByOrg(orgID int64) ([]OrgClusterRelation, error)

GetOrgClusterRelationsByOrg 根据 orgID 获取企业对应集群关系

func (*DBClient) GetOrgList

func (client *DBClient) GetOrgList() ([]Org, error)

GetOrgList 获取所有企业列表(仅供内部用户使用)

func (*DBClient) GetOrgsByIDsAndName

func (client *DBClient) GetOrgsByIDsAndName(orgIDs []int64, name string, pageNo, pageSize int) (
	int, []Org, error)

GetOrgsByIDsAndName 根据企业ID列表 & 企业名称获取企业列表

func (*DBClient) GetOrgsByParam

func (client *DBClient) GetOrgsByParam(name string, pageNum, pageSize int) (int, []Org, error)

GetOrgsByParam 获取企业列表

func (*DBClient) GetOrgsByUserID

func (client *DBClient) GetOrgsByUserID(userID string) ([]Org, error)

GetOrgsByUserID 根据userID获取企业列表

func (*DBClient) GetPublicOrgsByParam

func (client *DBClient) GetPublicOrgsByParam(name string, pageNum, pageSize int) (int, []Org, error)

GetPublicOrgsByParam Get public orgs list

func (*DBClient) ListAllOrgClusterRelations

func (client *DBClient) ListAllOrgClusterRelations() ([]OrgClusterRelation, error)

ListAllOrgClusterRelations 获取所有企业对应集群关系

func (*DBClient) UpdateOrg

func (client *DBClient) UpdateOrg(org *Org) error

UpdateOrg 更新企业元信息,不可更改企业名称

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"`
	EnableAI                  bool `json:"enableAI"`
}

func (*OrgConfig) Scan

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

func (OrgConfig) Value

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

Jump to

Keyboard shortcuts

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