db

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AlarmModeDefault int = iota
	AlarmModeWithInSQL
	AlarmModeAggregation
)
View Source
const (
	AlarmLevelDefault int = iota
	AlarmLevelKnow
	AlarmLevelFatal
)
View Source
const (
	AlarmStatusClose = iota + 1
	AlarmStatusOpen
	AlarmStatusFiring
)
View Source
const (
	HashTypeSip int = 1
	HashTypeURL int = 2
)
View Source
const (
	DatasourceMySQL      = "mysql"
	DatasourceClickHouse = "ch"
)
View Source
const (
	RuleStoreTypeFile = 1
	RuleStoreTypeK8s  = 2
)
View Source
const (
	TimeFieldTypeDT   = 0 // DateTime
	TimeFieldTypeTs   = 1 // unix seconds
	TimeFieldTypeTsMs = 2 // unix ms
	TimeFieldTypeDT3  = 3 // DataTime64(3)
)
View Source
const (
	TableNameUser         = "cv_user"
	TableEvent            = "cv_event"
	TableNameK8SConfigMap = "cv_k8s_cm"
	TableNameCluster      = "cv_cluster"

	TableNameBaseView        = "cv_base_view"
	TableNameBaseTable       = "cv_base_table"
	TableNameBaseIndex       = "cv_base_index"
	TableNameBaseDatabase    = "cv_base_database"
	TableNameBaseInstance    = "cv_base_instance"
	TableNameBaseHiddenField = "cv_base_hidden_field"

	TableAlarm          = "cv_alarm"
	TableAlarmFilter    = "cv_alarm_filter"
	TableAlarmHistory   = "cv_alarm_history"
	TableAlarmChannel   = "cv_alarm_channel"
	TableAlarmCondition = "cv_alarm_condition"

	TableNameConfiguration        = "cv_configuration"
	TableNameConfigurationHistory = "cv_configuration_history"
	TableNameConfigurationPublish = "cv_configuration_publish"

	TableNamePmsRole         = "cv_pms_role"
	TableNamePmsRoleRef      = "cv_pms_role_ref"
	TableNamePmsRoleDetail   = "cv_pms_role_detail"
	TableNamePmsRoleRefGrant = "cv_pms_role_ref_grant"
	TableNamePmsCasbinRule   = "cv_pms_casbin_rule"
	TableNamePmsCustomRole   = "cv_pms_custom_role"
	TableNamePmsDefaultRole  = "cv_pms_default_role"

	TableNameBigDataNode        = "cv_bd_node"
	TableNameBigDataNodeResult  = "cv_bd_node_result"
	TableNameBigDataNodeContent = "cv_bd_node_content"
	TableNameBigDataNodeHistory = "cv_bd_node_history"
	TableNameBigDataFolder      = "cv_bd_folder"
	TableNameBigDataSource      = "cv_bd_source"
	TableNameBigDataWorkflow    = "cv_bd_workflow"
	TableNameBigDataDepend      = "cv_bd_depend"
	TableNameBigDataCrontab     = "cv_bd_crontab"
)
View Source
const (
	OpnLocalUsersPwdChange = "local_user_pwd_change"

	OpnMigration = "system_setting_migration"

	OpnTablesDelete         = "opn_tables_delete"
	OpnTablesCreate         = "opn_tables_create"
	OpnTableCreateSelfBuilt = "opn_tables_create_self_built"
	OpnTablesUpdate         = "opn_tables_update"
	OpnTablesIndexUpdate    = "opn_tables_index_update"
	OpnTablesLogsQuery      = "opn_tables_logs_query"
	OpnDatabasesDelete      = "opn_databases_delete"
	OpnDatabasesCreate      = "opn_databases_create"
	OpnDatabasesUpdate      = "opn_databases_update"
	OpnInstancesDelete      = "opn_instances_delete"
	OpnInstancesCreate      = "opn_instances_create"
	OpnInstancesUpdate      = "opn_instances_update"
	OpnViewsDelete          = "opn_views_delete"
	OpnViewsCreate          = "opn_views_create"
	OpnViewsUpdate          = "opn_views_update"

	OpnConfigsDelete  = "opn_configs_delete"
	OpnConfigsCreate  = "opn_configs_create"
	OpnConfigsUpdate  = "opn_configs_update"
	OpnConfigsPublish = "opn_configs_publish"
	OpnConfigsSync    = "opn_configs_sync"

	OpnClustersDelete          = "opn_clusters_delete"
	OpnClustersCreate          = "opn_clusters_create"
	OpnClustersUpdate          = "opn_clusters_update"
	OpnClustersConfigMapDelete = "opn_clusters_config_map_delete"
	OpnClustersConfigMapCreate = "opn_clusters_config_map_create"
	OpnClustersConfigMapUpdate = "opn_clusters_config_map_update"

	OpnAlarmsDelete         = "opn_alarms_delete"
	OpnAlarmsCreate         = "opn_alarms_create"
	OpnAlarmsUpdate         = "opn_alarms_update"
	OpnAlarmsChannelsDelete = "opn_alarms_channels_delete"
	OpnAlarmsChannelsCreate = "opn_alarms_channels_create"
	OpnAlarmsChannelsUpdate = "opn_alarms_channels_update"

	OpnBigDataNodeCreate        = "opn_big_data_node_create"
	OpnBigDataNodeUpdate        = "opn_big_data_node_update"
	OpnBigDataNodeDelete        = "opn_big_data_node_delete"
	OpnBigDataFolderCreate      = "opn_big_data_folder_create"
	OpnBigDataFolderUpdate      = "opn_big_data_folder_update"
	OpnBigDataFolderDelete      = "opn_big_data_folder_delete"
	OpnBigDataNodeCrontabCreate = "opn_big_data_node_crontab_create"
	OpnBigDataNodeCrontabUpdate = "opn_big_data_node_crontab_update"
	OpnBigDataNodeCrontabDelete = "opn_big_data_node_crontab_delete"
	OpnBigDataNodeCrontabStop   = "opn_big_data_node_crontab_stop"
	OpnBigDataNodeResultUpdate  = "opn_big_data_node_result_update"
	OpnBigDataWorkflowCreate    = "opn_big_data_workflow_create"
	OpnBigDataWorkflowUpdate    = "opn_big_data_workflow_update"
	OpnBigDataWorkflowDelete    = "opn_big_data_workflow_delete"
	OpnBigDataSourceCreate      = "opn_big_data_source_create"
	OpnBigDataSourceUpdate      = "opn_big_data_source_update"
	OpnBigDataSourceDelete      = "opn_big_data_source_delete"
	OpnBigDataNodeLock          = "opn_big_data_node_lock"
	OpnBigDataNodeUnlock        = "opn_big_data_node_unlock"
	OpnBigDataNodeRun           = "opn_big_data_node_run"
	OpnBigDataNodeStop          = "opn_big_data_node_strop"
)

abbr. -> fullName "Opn" -> "Operation" "mgt" -> "management"

View Source
const (
	SourceInquiryMgtCenter = "log_mgt"
	SourceUserMgtCenter    = "user_mgt"
	SourceSystemSetting    = "system_setting"
	SourceClusterMgtCenter = "cluster_mgt"
	SourceAlarmMgtCenter   = "alarm_mgt"
	SourceConfigMgtCenter  = "config_mgt"
	SourceBigDataMgtCenter = "bigdata_mgt"
)
View Source
const (
	CrontabTypNormal int = iota
	CrontabTypSuspended
)
View Source
const (
	CrontabStatusWait int = iota
	CrontabStatusPreempt
	CrontabStatusDoing
)
View Source
const (
	SourceTypMySQL      = 1
	SourceTypClickHouse = 2
)
View Source
const (
	PrimaryMining = 1
	PrimaryShort  = 3
)
View Source
const (
	SecondaryAny             = 0
	SecondaryDatabase        = 1
	SecondaryDataIntegration = 2
	SecondaryDataMining      = 3
	SecondaryDashboard       = 4
)
View Source
const (
	TertiaryClickHouse   = 10
	TertiaryMySQL        = 11
	TertiaryOfflineSync  = 20
	TertiaryRealTimeSync = 21
)
View Source
const (
	NodeStatusDefault = 0
	NodeStatusHandler = 2
	NodeStatusError   = 3
	NodeStatusFinish  = 4
)

0 No status 2 Executing 3 Abnormal execution 4 Completed

View Source
const (
	PmsRoleTypeUnknown = iota
	PmsRoleTypeDefault
	PmsRoleTypeCustom
)
View Source
const (
	RefId = "{{ID}}" // is used to replace with real resourceObjId in ruleTpl when adding to casbin
	// used to generate "p" type ruleTpl like: role__{{PmsRole:Id}}__{{PmsRole:BelongResource}}__{{ID}},{{PmsRole:BelongResource}}__{{ID}}__subResource__(SubResourceRegex),ActsRegex,{{DOM}}
	TplOfRuleTpl = "role__%d__%s__{{ID}},%s__{{ID}}__subResource__%s,%s,*" // contains the const RefId. do not contain any blank chars
)
View Source
const (
	ClusterStatusNormal = iota
	ClusterStatusMaintaining
	ClusterStatusNotAvailable
)

status of kubernetes cluster

View Source
const TimeFieldNanoseconds = "_time_nanosecond_"
View Source
const TimeFieldSecond = "_time_second_"

Variables

View Source
var (
	SourceMap = map[string]string{
		SourceInquiryMgtCenter: "Log",
		SourceUserMgtCenter:    "User",
		SourceSystemSetting:    "System",
		SourceClusterMgtCenter: "K8s",
		SourceAlarmMgtCenter:   "Alarm",
		SourceConfigMgtCenter:  "Configuration",
		SourceBigDataMgtCenter: "Analysis",
	}
	SourceOpnMap = map[string][]string{
		SourceInquiryMgtCenter: {
			OpnTablesDelete,
			OpnTablesCreate,
			OpnTablesUpdate,
			OpnTablesIndexUpdate,
			OpnTablesLogsQuery,
			OpnDatabasesDelete,
			OpnDatabasesCreate,
			OpnDatabasesUpdate,
			OpnInstancesDelete,
			OpnInstancesCreate,
			OpnInstancesUpdate,
			OpnViewsDelete,
			OpnViewsCreate,
			OpnViewsUpdate,
		},
		SourceClusterMgtCenter: {
			OpnClustersDelete,
			OpnClustersCreate,
			OpnClustersUpdate,
		},
		SourceAlarmMgtCenter: {
			OpnAlarmsDelete,
			OpnAlarmsCreate,
			OpnAlarmsUpdate,
			OpnAlarmsChannelsDelete,
			OpnAlarmsChannelsCreate,
			OpnAlarmsChannelsUpdate,
		},
		SourceConfigMgtCenter: {
			OpnConfigsDelete,
			OpnConfigsCreate,
			OpnConfigsUpdate,
			OpnConfigsPublish,
		},
		SourceUserMgtCenter: {OpnLocalUsersPwdChange},
		SourceSystemSetting: {OpnMigration},
		SourceBigDataMgtCenter: {
			OpnBigDataNodeCreate,
			OpnBigDataNodeUpdate,
			OpnBigDataNodeDelete,
			OpnBigDataFolderCreate,
			OpnBigDataFolderUpdate,
			OpnBigDataFolderDelete,
			OpnBigDataNodeCrontabCreate,
			OpnBigDataNodeCrontabUpdate,
			OpnBigDataNodeCrontabDelete,
			OpnBigDataNodeCrontabStop,
			OpnBigDataNodeResultUpdate,
			OpnBigDataWorkflowCreate,
			OpnBigDataWorkflowUpdate,
			OpnBigDataWorkflowDelete,
			OpnBigDataSourceCreate,
			OpnBigDataSourceUpdate,
			OpnBigDataSourceDelete,
			OpnBigDataNodeLock,
			OpnBigDataNodeUnlock,
			OpnBigDataNodeRun,
			OpnBigDataNodeStop},
	}
)
View Source
var OperationMap = map[string]string{
	OpnLocalUsersPwdChange: "change the password",

	OpnTablesDelete:         "table delete",
	OpnTablesCreate:         "table create",
	OpnTablesUpdate:         "table update",
	OpnTableCreateSelfBuilt: "an existing data table is connected",
	OpnTablesIndexUpdate:    "table analysis field updates",
	OpnTablesLogsQuery:      "log query",
	OpnDatabasesDelete:      "database delete",
	OpnDatabasesCreate:      "database create",
	OpnDatabasesUpdate:      "database update",
	OpnInstancesDelete:      "instance delete",
	OpnInstancesCreate:      "instance create",
	OpnInstancesUpdate:      "instance update",
	OpnViewsDelete:          "custom time field delete",
	OpnViewsCreate:          "custom time field create",
	OpnViewsUpdate:          "custom time field update",

	OpnConfigsDelete:  "config delete",
	OpnConfigsCreate:  "config create",
	OpnConfigsUpdate:  "config update",
	OpnConfigsPublish: "config publish",
	OpnConfigsSync:    "synchronize the configuration from the target cluster",

	OpnClustersDelete:          "cluster delete",
	OpnClustersCreate:          "cluster create",
	OpnClustersUpdate:          "cluster update",
	OpnClustersConfigMapDelete: "cluster configmap delete",
	OpnClustersConfigMapCreate: "cluster configmap create",
	OpnClustersConfigMapUpdate: "cluster configmap update",

	OpnAlarmsDelete:         "alarm delete",
	OpnAlarmsCreate:         "alarm create",
	OpnAlarmsUpdate:         "alarm update",
	OpnAlarmsChannelsDelete: "alarm channel delete",
	OpnAlarmsChannelsCreate: "alarm channel create",
	OpnAlarmsChannelsUpdate: "alarm channel update",

	OpnMigration: "upgrading the database structure",

	OpnBigDataNodeCreate:        "node create",
	OpnBigDataNodeUpdate:        "node update",
	OpnBigDataNodeDelete:        "node delete",
	OpnBigDataFolderCreate:      "folder create",
	OpnBigDataFolderUpdate:      "folder update",
	OpnBigDataFolderDelete:      "folder delete",
	OpnBigDataNodeCrontabCreate: "node crontab create",
	OpnBigDataNodeCrontabUpdate: "node crontab update",
	OpnBigDataNodeCrontabDelete: "node crontab delete",
	OpnBigDataNodeCrontabStop:   "node crontab stop",
	OpnBigDataNodeResultUpdate:  "node run result update",
	OpnBigDataWorkflowCreate:    "workflow create",
	OpnBigDataWorkflowUpdate:    "workflow update",
	OpnBigDataWorkflowDelete:    "workflow delete",
	OpnBigDataSourceCreate:      "source create",
	OpnBigDataSourceUpdate:      "source update",
	OpnBigDataSourceDelete:      "source delete",
	OpnBigDataNodeLock:          "node lock",
	OpnBigDataNodeUnlock:        "node unlock",
	OpnBigDataNodeRun:           "node run",
	OpnBigDataNodeStop:          "node stop",
}
View Source
var UnitMap = map[int]UnitItem{
	0: {
		Alias:    "m",
		Duration: time.Minute,
	},
	1: {
		Alias:    "s",
		Duration: time.Second,
	},
	2: {
		Alias:    "h",
		Duration: time.Hour,
	},
	3: {
		Alias:    "d",
		Duration: time.Hour * 24,
	},
	4: {
		Alias:    "w",
		Duration: time.Hour * 24 * 7,
	},
}

Functions

func AlarmChannelCreate

func AlarmChannelCreate(db *gorm.DB, data *AlarmChannel) (err error)

func AlarmChannelDelete

func AlarmChannelDelete(db *gorm.DB, id int) (err error)

func AlarmChannelDeleteBatch

func AlarmChannelDeleteBatch(db *gorm.DB, tid int) (err error)

func AlarmChannelUpdate

func AlarmChannelUpdate(db *gorm.DB, id int, ups map[string]interface{}) (err error)

func AlarmConditionCreate

func AlarmConditionCreate(db *gorm.DB, data *AlarmCondition) (err error)

func AlarmConditionDelete

func AlarmConditionDelete(db *gorm.DB, id int) (err error)

func AlarmConditionDeleteBatch

func AlarmConditionDeleteBatch(db *gorm.DB, alarmId int) (err error)

func AlarmConditionUpdate

func AlarmConditionUpdate(db *gorm.DB, id int, ups map[string]interface{}) (err error)

func AlarmCreate

func AlarmCreate(db *gorm.DB, data *Alarm) (err error)

func AlarmDelete

func AlarmDelete(db *gorm.DB, id int) (err error)

func AlarmDeleteBatch

func AlarmDeleteBatch(db *gorm.DB, tid int) (err error)

func AlarmFilterCreate

func AlarmFilterCreate(db *gorm.DB, data *AlarmFilter) (err error)

func AlarmFilterDelete

func AlarmFilterDelete(db *gorm.DB, id int) (err error)

func AlarmFilterDeleteBatch

func AlarmFilterDeleteBatch(db *gorm.DB, alarmId int) (err error)

func AlarmFilterUpdate

func AlarmFilterUpdate(db *gorm.DB, id int, ups map[string]interface{}) (err error)

func AlarmHistoryCreate

func AlarmHistoryCreate(db *gorm.DB, data *AlarmHistory) (err error)

func AlarmHistoryDelete

func AlarmHistoryDelete(db *gorm.DB, id int) (err error)

func AlarmHistoryDeleteBatch

func AlarmHistoryDeleteBatch(db *gorm.DB, tid int) (err error)

func AlarmHistoryUpdate

func AlarmHistoryUpdate(db *gorm.DB, id int, ups map[string]interface{}) (err error)

func AlarmStatusUpdate

func AlarmStatusUpdate(id int, status string) (err error)

func AlarmUpdate

func AlarmUpdate(db *gorm.DB, id int, ups map[string]interface{}) (err error)

func BuildPreloadArgs

func BuildPreloadArgs(conds Conds) (args []interface{})

func BuildQuery

func BuildQuery(conds Conds) (sql string, binds []interface{})

BuildQuery 根据conds构建sql和绑定的参数

func CasbinRuleDelete

func CasbinRuleDelete(tx *gorm.DB, conds egorm.Conds) (err error)

use it carefully.

func ClusterCreate

func ClusterCreate(db *gorm.DB, data *Cluster) (err error)

ClusterCreate CRUD

func ClusterDelete

func ClusterDelete(db *gorm.DB, id int) (err error)

ClusterDelete soft delete item by id

func ClusterUpdate

func ClusterUpdate(db *gorm.DB, paramId int, ups map[string]interface{}) (err error)

ClusterUpdate ...

func ClusterUpdateX

func ClusterUpdateX(db *gorm.DB, conds egorm.Conds, ups map[string]interface{}) (err error)

func ConfigurationCreate

func ConfigurationCreate(db *gorm.DB, data *Configuration) (err error)

ConfigurationCreate CRUD

func ConfigurationDelete

func ConfigurationDelete(db *gorm.DB, id int) (err error)

ConfigurationDelete 硬删除

func ConfigurationHistoryCreate

func ConfigurationHistoryCreate(db *gorm.DB, data *ConfigurationHistory) (err error)

ConfigurationHistoryCreate CRUD

func ConfigurationHistoryDelete

func ConfigurationHistoryDelete(db *gorm.DB, id int) (err error)

ConfigurationHistoryDelete soft delete item by id

func ConfigurationHistoryUpdate

func ConfigurationHistoryUpdate(db *gorm.DB, paramId int, ups map[string]interface{}) (err error)

ConfigurationHistoryUpdate ...

func ConfigurationPublishCreate

func ConfigurationPublishCreate(db *gorm.DB, data *ConfigurationPublish) (err error)

ConfigurationPublishCreate CRUD

func ConfigurationPublishDelete

func ConfigurationPublishDelete(db *gorm.DB, id int) (err error)

ConfigurationPublishDelete soft delete item by id

func ConfigurationPublishUpdate

func ConfigurationPublishUpdate(db *gorm.DB, paramId int, ups map[string]interface{}) (err error)

ConfigurationPublishUpdate ...

func ConfigurationUpdate

func ConfigurationUpdate(db *gorm.DB, paramId int, ups map[string]interface{}) (err error)

ConfigurationUpdate ...

func CreatePmsRole

func CreatePmsRole(db *gorm.DB, data *PmsRole) (err error)

func CreatePmsRoleDetail

func CreatePmsRoleDetail(db *gorm.DB, data *PmsRoleDetail) (err error)

func CreatePmsRoleRef

func CreatePmsRoleRef(db *gorm.DB, data *PmsRoleRef) (err error)

func CrontabCreate added in v0.3.2

func CrontabCreate(db *gorm.DB, data *BigdataCrontab) (err error)

func CrontabDelete added in v0.3.2

func CrontabDelete(db *gorm.DB, nodeId int) (err error)

func CrontabUpdate added in v0.3.2

func CrontabUpdate(db *gorm.DB, nodeId int, ups map[string]interface{}) (err error)

func DatabaseCreate

func DatabaseCreate(db *gorm.DB, data *BaseDatabase) (err error)

DatabaseCreate ...

func DatabaseDelete

func DatabaseDelete(db *gorm.DB, id int) (err error)

DatabaseDelete Soft delete

func DatabaseUpdate

func DatabaseUpdate(db *gorm.DB, paramId int, ups map[string]interface{}) (err error)

DatabaseUpdate ...

func DeletePmsRoleById

func DeletePmsRoleById(tx *gorm.DB, pmsRoleId int) (err error)

please make sure the associated casbinRules have removed after deleted pmsRole. do not only invoke this func to delete pmsRole.

func DeletePmsRoleDetailById

func DeletePmsRoleDetailById(db *gorm.DB, id int) (err error)

func DeletePmsRoleRef

func DeletePmsRoleRef(tx *gorm.DB, id int) (err error)

func DependsBatchInsert added in v0.3.2

func DependsBatchInsert(db *gorm.DB, rows []*BigdataDepend) (err error)

func DependsCreateOrUpdate added in v0.3.2

func DependsCreateOrUpdate(db *gorm.DB, data *BigdataDepend) (err error)

func DependsDeleteAll added in v0.3.2

func DependsDeleteAll(db *gorm.DB, iid int) (err error)

func DependsDeleteTimeout added in v0.3.2

func DependsDeleteTimeout(db *gorm.DB) (err error)

func DependsUpdate added in v0.3.2

func DependsUpdate(db *gorm.DB, iid int, database, table string, ups map[string]interface{}) (err error)

func FolderCreate added in v0.3.1

func FolderCreate(db *gorm.DB, data *BigdataFolder) (err error)

func FolderDelete added in v0.3.1

func FolderDelete(db *gorm.DB, id int) (err error)

func FolderDeleteBatch added in v0.3.1

func FolderDeleteBatch(db *gorm.DB, tid int) (err error)

func FolderUpdate added in v0.3.1

func FolderUpdate(db *gorm.DB, id int, ups map[string]interface{}) (err error)

func GetAlarmTableInstanceInfo

func GetAlarmTableInstanceInfo(id int) (instanceInfo BaseInstance, tableInfo BaseTable, alarmInfo Alarm, err error)

func HiddenFieldCreateBatch added in v0.3.1

func HiddenFieldCreateBatch(db *gorm.DB, data []*BaseHiddenField) (err error)

func HiddenFieldDeleteByFields added in v0.3.1

func HiddenFieldDeleteByFields(db *gorm.DB, fields []string) (err error)

func IndexCreate

func IndexCreate(db *gorm.DB, data *BaseIndex) (err error)

func IndexDelete

func IndexDelete(db *gorm.DB, id int) (err error)

func IndexDeleteBatch

func IndexDeleteBatch(db *gorm.DB, tid int) (err error)

func IndexUpdate

func IndexUpdate(db *gorm.DB, id int, ups map[string]interface{}) (err error)

func InstanceCreate

func InstanceCreate(db *gorm.DB, data *BaseInstance) (err error)

func InstanceDelete

func InstanceDelete(db *gorm.DB, id int) (err error)

func InstanceKey

func InstanceKey(id int) string

func InstanceUpdate

func InstanceUpdate(db *gorm.DB, id int, ups map[string]interface{}) (err error)

func K8SConfigMapCreate

func K8SConfigMapCreate(db *gorm.DB, data *K8SConfigMap) (err error)

K8SConfigMapCreate CRUD

func K8SConfigMapDelete

func K8SConfigMapDelete(db *gorm.DB, id int) (err error)

K8SConfigMapDelete soft delete item by id

func K8SConfigMapUpdate

func K8SConfigMapUpdate(db *gorm.DB, paramId int, ups map[string]interface{}) (err error)

K8SConfigMapUpdate ...

func NodeContentCreate added in v0.3.1

func NodeContentCreate(db *gorm.DB, data *BigdataNodeContent) (err error)

func NodeContentDelete added in v0.3.1

func NodeContentDelete(db *gorm.DB, id int) (err error)

func NodeContentUpdate added in v0.3.1

func NodeContentUpdate(db *gorm.DB, id int, ups map[string]interface{}) (err error)

func NodeCreate added in v0.3.1

func NodeCreate(db *gorm.DB, data *BigdataNode) (err error)

func NodeDelete added in v0.3.1

func NodeDelete(db *gorm.DB, id int) (err error)

func NodeHistoryCreate added in v0.3.1

func NodeHistoryCreate(db *gorm.DB, data *BigdataNodeHistory) (err error)

func NodeResultCreate added in v0.3.2

func NodeResultCreate(db *gorm.DB, data *BigdataNodeResult) (err error)

func NodeResultDelete added in v0.3.2

func NodeResultDelete(db *gorm.DB, id int) (err error)

func NodeResultDelete30Days added in v0.3.2

func NodeResultDelete30Days()

func NodeResultUpdate added in v0.3.2

func NodeResultUpdate(db *gorm.DB, id int, ups map[string]interface{}) (err error)

func NodeUpdate added in v0.3.1

func NodeUpdate(db *gorm.DB, id int, ups map[string]interface{}) (err error)

func PmsCustomRoleCreate

func PmsCustomRoleCreate(item *PmsCustomRole) (err error)

func PmsCustomRoleDelete

func PmsCustomRoleDelete(paramId int) (err error)

func PmsDefaultRoleCreate

func PmsDefaultRoleCreate(item *PmsDefaultRole) (err error)

func PmsDefaultRoleDelete

func PmsDefaultRoleDelete(paramId int) (err error)

func SourceCreate added in v0.3.1

func SourceCreate(db *gorm.DB, data *BigdataSource) (err error)

func SourceDelete added in v0.3.1

func SourceDelete(db *gorm.DB, id int) (err error)

func SourceUpdate added in v0.3.1

func SourceUpdate(db *gorm.DB, id int, ups map[string]interface{}) (err error)

func TableCreate

func TableCreate(db *gorm.DB, data *BaseTable) (err error)

TableCreate ...

func TableDelete

func TableDelete(db *gorm.DB, id int) (err error)

TableDelete Soft delete

func TableUpdate

func TableUpdate(db *gorm.DB, paramId int, ups map[string]interface{}) (err error)

TableUpdate ...

func UpdatePmsRoleDetail

func UpdatePmsRoleDetail(db *gorm.DB, id int, ups map[string]interface{}) (err error)

not allow update pms_role_id column of PmsRoleDetail

func UserCreate

func UserCreate(db *gorm.DB, data *User) (err error)

UserCreate CRUD

func UserDelete

func UserDelete(db *gorm.DB, id int) (err error)

UserDelete soft delete item by id

func UserUpdate

func UserUpdate(db *gorm.DB, paramId int, ups map[string]interface{}) (err error)

UserUpdate ...

func ViewCreate

func ViewCreate(db *gorm.DB, data *BaseView) (err error)

func ViewDelete

func ViewDelete(db *gorm.DB, id int) (err error)

ViewDelete Soft delete

func ViewDeleteByTableID

func ViewDeleteByTableID(db *gorm.DB, tid int) (err error)

ViewDeleteByTableID Soft delete

func ViewUpdate

func ViewUpdate(db *gorm.DB, paramId int, ups map[string]interface{}) (err error)

ViewUpdate ...

func WhereConditionFromFilter

func WhereConditionFromFilter(alarm *Alarm, filters []*AlarmFilter) (filter string)

func WorkflowCreate added in v0.3.1

func WorkflowCreate(db *gorm.DB, data *BigdataWorkflow) (err error)

func WorkflowDelete added in v0.3.1

func WorkflowDelete(db *gorm.DB, id int) (err error)

func WorkflowUpdate added in v0.3.1

func WorkflowUpdate(db *gorm.DB, id int, ups map[string]interface{}) (err error)

Types

type Alarm

type Alarm struct {
	BaseModel

	Uid           int           `gorm:"column:uid;type:int(11)" json:"uid"`                                            // uid of alarm operator
	Tid           int           `gorm:"column:tid;type:int(11)" json:"tid"`                                            // table id
	Uuid          string        `gorm:"column:uuid;type:varchar(128);NOT NULL" json:"uuid"`                            // foreign key
	Name          string        `gorm:"column:name;type:varchar(128);NOT NULL" json:"alarmName"`                       // name of an alarm
	Desc          string        `gorm:"column:desc;type:varchar(255);NOT NULL" json:"desc"`                            // description
	Interval      int           `gorm:"column:interval;type:int(11)" json:"interval"`                                  // interval second between alarm
	Unit          int           `gorm:"column:unit;type:int(11)" json:"unit"`                                          // 0 m 1 s 2 h 3 d 4 w 5 y
	AlertRule     string        `gorm:"column:alert_rule;type:text" json:"alertRule"`                                  // prometheus alert rule
	View          string        `gorm:"column:view;type:text" json:"view"`                                             // view table ddl
	ViewTableName string        `gorm:"column:view_table_name;type:varchar(255)" json:"viewTableName"`                 // name of view table
	Tags          String2String `gorm:"column:tag;type:text" json:"tag"`                                               // tags
	Status        int           `gorm:"column:status;type:int(11)" json:"status"`                                      // status
	RuleStoreType int           `gorm:"column:rule_store_type;type:int(11)" db:"rule_store_type" json:"ruleStoreType"` // ruleStoreType
	ChannelIds    Ints          `gorm:"column:channel_ids;type:varchar(255);NOT NULL" json:"channelIds"`               // channel of an alarm
	NoDataOp      int           `gorm:"column:no_data_op;type:int(11)" db:"no_data_op" json:"noDataOp"`                // noDataOp 0 nodata 1 ok 2 alert
	Mode          int           `gorm:"column:mode;type:int(11)" json:"mode"`                                          // 0 m 1 s 2 h 3 d 4 w 5 y
	Level         int           `gorm:"column:level;type:int(11)" json:"level"`                                        // 0 m 1 s 2 h 3 d 4 w 5 y

	User *User `json:"user,omitempty" gorm:"foreignKey:uid;references:id"`
}

Alarm defines alarm table structure

func AlarmInfo

func AlarmInfo(db *gorm.DB, id int) (resp Alarm, err error)

func AlarmInfoX

func AlarmInfoX(db *gorm.DB, conds map[string]interface{}) (resp Alarm, err error)

func AlarmList

func AlarmList(conds egorm.Conds) (resp []*Alarm, err error)

func AlarmListByDidPage

func AlarmListByDidPage(conds egorm.Conds, reqList *ReqPage) (total int64, respList []*Alarm)

func AlarmListPage

func AlarmListPage(conds egorm.Conds, reqList *ReqPage) (total int64, respList []*Alarm)

AlarmListPage return item list by pagination

func (*Alarm) AlertInterval

func (m *Alarm) AlertInterval() string

func (*Alarm) AlertRuleName

func (m *Alarm) AlertRuleName() string

func (*Alarm) AlertUniqueName

func (m *Alarm) AlertUniqueName() string

func (*Alarm) AlertViewName

func (m *Alarm) AlertViewName(database, table string) string

func (*Alarm) TableName

func (m *Alarm) TableName() string

type AlarmChannel

type AlarmChannel struct {
	BaseModel

	Name string `gorm:"column:name;type:varchar(128);NOT NULL" json:"name"` // 告警渠道名称
	Key  string `gorm:"column:key;type:text" json:"key"`                    // 关键信息
	Typ  int    `gorm:"column:typ;type:int(11)" json:"typ"`                 // 告警类型:0 dd
	Uid  int    `gorm:"column:uid;type:int(11)" json:"uid"`                 // 操作人
}

AlarmChannel 告警渠道

func AlarmChannelInfo

func AlarmChannelInfo(db *gorm.DB, id int) (resp AlarmChannel, err error)

func AlarmChannelList

func AlarmChannelList(conds egorm.Conds) (resp []*AlarmChannel, err error)

func (*AlarmChannel) TableName

func (m *AlarmChannel) TableName() string

type AlarmCondition

type AlarmCondition struct {
	BaseModel

	AlarmId        int `gorm:"column:alarm_id;type:int(11)" json:"alarmId"`              // alarm id
	SetOperatorTyp int `gorm:"column:set_operator_typ;type:int(11);NOT NULL" json:"typ"` // 0 WHEN 1 AND 2 OR
	SetOperatorExp int `gorm:"column:set_operator_exp;type:int(11);NOT NULL" json:"exp"` // 0 avg 1 min 2 max 3 sum 4 count
	Cond           int `gorm:"column:cond;type:int(11)" json:"cond"`                     // 0 above 1 below 2 outside range 3 within range
	Val1           int `gorm:"column:val_1;type:int(11)" json:"val1"`                    // 基准值/最小值
	Val2           int `gorm:"column:val_2;type:int(11)" json:"val2"`                    // 最大值
}

AlarmCondition 告警触发条件

func AlarmConditionInfo

func AlarmConditionInfo(db *gorm.DB, id int) (resp AlarmCondition, err error)

func AlarmConditionList

func AlarmConditionList(conds egorm.Conds) (resp []*AlarmCondition, err error)

func (*AlarmCondition) TableName

func (m *AlarmCondition) TableName() string

type AlarmFilter

type AlarmFilter struct {
	BaseModel

	Tid            int    `gorm:"column:tid;type:int(11)" json:"tid"`                            // table id
	AlarmId        int    `gorm:"column:alarm_id;type:int(11)" json:"alarmId"`                   // alarm id
	When           string `gorm:"column:when;type:text" json:"when"`                             // 执行条件
	SetOperatorTyp int    `gorm:"column:set_operator_typ;type:int(11);NOT NULL" json:"typ"`      // 0 default 1 INNER 2 LEFT OUTER 3 RIGHT OUTER 4 FULL OUTER 5 CROSS
	SetOperatorExp string `gorm:"column:set_operator_exp;type:varchar(255);NOT NULL" json:"exp"` // 操作
	Mode           int    `gorm:"column:mode;type:int(11)" json:"mode"`                          // 0 m 1 s 2 h 3 d 4 w 5 y
}

AlarmFilter 告警过滤条件

func AlarmFilterInfo

func AlarmFilterInfo(db *gorm.DB, id int) (resp AlarmFilter, err error)

func AlarmFilterList

func AlarmFilterList(conds egorm.Conds) (resp []*AlarmFilter, err error)

func (*AlarmFilter) TableName

func (m *AlarmFilter) TableName() string

type AlarmHistory

type AlarmHistory struct {
	BaseModel

	AlarmId  int `gorm:"column:alarm_id;type:int(11)" json:"alarmId"`   // alarm id
	IsPushed int `gorm:"column:is_pushed;type:int(11)" json:"isPushed"` // alarm id
}

AlarmHistory 告警渠道

func AlarmHistoryInfo

func AlarmHistoryInfo(db *gorm.DB, id int) (resp AlarmHistory, err error)

func AlarmHistoryList

func AlarmHistoryList(conds egorm.Conds) (resp []*AlarmHistory, err error)

func AlarmHistoryPage

func AlarmHistoryPage(conds egorm.Conds, reqList *ReqPage) (total int64, respList []*AlarmHistory)

func (*AlarmHistory) TableName

func (m *AlarmHistory) TableName() string

type BaseDatabase added in v0.3.1

type BaseDatabase struct {
	BaseModel

	Iid          int    `gorm:"column:iid;type:int(11);index:uix_iid_name,unique" json:"iid"`                 // datasource instance id
	Name         string `gorm:"column:name;type:varchar(128);index:uix_iid_name,unique;NOT NULL" json:"name"` // datasource database name
	Uid          int    `gorm:"column:uid;type:int(11)" json:"uid"`                                           // datasource operator uid
	Cluster      string `gorm:"column:cluster;type:varchar(128);NOT NULL" json:"cluster"`                     // cluster
	IsCreateByCV int    `gorm:"column:is_create_by_cv;type:tinyint(1)" json:"isCreateByCV"`
	Desc         string `gorm:"column:desc;type:varchar(255)" json:"desc"`

	Instance *BaseInstance `json:"instance,omitempty" gorm:"foreignKey:Iid;references:ID"`
}

BaseDatabase 数据库管理

func DatabaseGetOrCreate

func DatabaseGetOrCreate(db *gorm.DB, uid, iid int, name string) (resp BaseDatabase, err error)

func DatabaseInfo

func DatabaseInfo(db *gorm.DB, paramId int) (resp BaseDatabase, err error)

func DatabaseInfoX

func DatabaseInfoX(db *gorm.DB, conds map[string]interface{}) (resp BaseDatabase, err error)

DatabaseInfoX Info extension method to query a single record according to Cond

func DatabaseList

func DatabaseList(db *gorm.DB, conds egorm.Conds) (resp []*BaseDatabase, err error)

DatabaseList Get all currently undeleted clusters. Mainly used for front end

func (*BaseDatabase) TableName added in v0.3.1

func (m *BaseDatabase) TableName() string

type BaseHiddenField added in v0.3.1

type BaseHiddenField struct {
	BaseModel

	Tid   int    `gorm:"column:tid;type:int(11);index:uix_tid_field,unique" json:"tid"`                   // table id idx
	Field string `gorm:"column:field;type:varchar(128);NOT NULL;index:uix_tid_field,unique" json:"field"` // index field name
}

func HiddenFieldList added in v0.3.1

func HiddenFieldList(conds egorm.Conds) (resp []*BaseHiddenField, err error)

func (*BaseHiddenField) TableName added in v0.3.1

func (t *BaseHiddenField) TableName() string

type BaseIndex added in v0.3.1

type BaseIndex struct {
	BaseModel

	Tid      int    `gorm:"column:tid;type:int(11);index:uix_tid_field_root,unique" json:"tid"`                          // table id
	Field    string `gorm:"column:field;type:varchar(128);NOT NULL;index:uix_tid_field_root,unique" json:"field"`        // index field name
	RootName string `gorm:"column:root_name;type:varchar(128);NOT NULL;index:uix_tid_field_root,unique" json:"rootName"` // root_name
	Typ      int    `gorm:"column:typ;type:int(11);NOT NULL" json:"typ"`                                                 // 0 string 1 int 2 float
	HashTyp  int    `gorm:"column:hash_typ;type:tinyint(1)" json:"hashTyp"`                                              // hash type, 0 no hash 1 sipHash64 2 URLHash
	Alias    string `gorm:"column:alias;type:varchar(128);NOT NULL" json:"alias"`                                        // index filed alias name
}

BaseIndex 索引数据存储

func IndexInfo

func IndexInfo(db *gorm.DB, id int) (resp BaseIndex, err error)

func IndexList

func IndexList(conds egorm.Conds) (resp []*BaseIndex, err error)

func (*BaseIndex) GetFieldName added in v0.3.1

func (t *BaseIndex) GetFieldName() string

func (*BaseIndex) GetHashFieldName added in v0.3.1

func (t *BaseIndex) GetHashFieldName() (string, bool)

func (*BaseIndex) TableName added in v0.3.1

func (t *BaseIndex) TableName() string

type BaseInstance added in v0.3.1

type BaseInstance struct {
	BaseModel

	Datasource       string  `gorm:"column:datasource;type:varchar(32);NOT NULL;index:idx_datasource_name,unique" json:"datasource"` // datasource type
	Name             string  `gorm:"column:name;type:varchar(128);NOT NULL;index:idx_datasource_name,unique" json:"name"`            // datasource instance name
	Dsn              string  `gorm:"column:dsn;type:text" json:"dsn"`                                                                // dsn
	RuleStoreType    int     `gorm:"column:rule_store_type;type:int(11)" json:"ruleStoreType"`                                       // rule_store_type 0 集群 1 文件
	FilePath         string  `gorm:"column:file_path;type:varchar(255)" json:"filePath"`                                             // file_path
	Desc             string  `gorm:"column:desc;type:varchar(255)" json:"desc"`                                                      // file_path
	ClusterId        int     `gorm:"column:cluster_id;type:int(11)" json:"clusterId"`                                                // cluster_id
	Namespace        string  `gorm:"column:namespace;type:varchar(128)" json:"namespace"`                                            // namespace
	Configmap        string  `gorm:"column:configmap;type:varchar(128)" json:"configmap"`                                            // configmap
	PrometheusTarget string  `gorm:"column:prometheus_target;type:varchar(128)" json:"prometheusTarget"`                             // prometheus ip or domain, eg: https://prometheus:9090
	Mode             int     `gorm:"column:mode;type:tinyint(1)" json:"mode"`                                                        // 0 standalone 1 cluster
	ReplicaStatus    int     `gorm:"column:replica_status;type:tinyint(1)" json:"replicaStatus"`                                     // status 0 has replica 1 no replica
	Clusters         Strings `gorm:"column:clusters;type:text" json:"clusters"`
}

BaseInstance 服务配置存储

func InstanceByName

func InstanceByName(dt, name string) (resp BaseInstance, err error)

func InstanceInfo

func InstanceInfo(db *gorm.DB, id int) (resp BaseInstance, err error)

func InstanceInfoX

func InstanceInfoX(db *gorm.DB, conds map[string]interface{}) (resp BaseInstance, err error)

InstanceInfoX Info extension method to query a single record according to Cond

func InstanceList

func InstanceList(conds egorm.Conds, extra ...string) (resp []*BaseInstance, err error)

InstanceList ..

func (*BaseInstance) DsKey added in v0.3.1

func (t *BaseInstance) DsKey() string

func (*BaseInstance) TableName added in v0.3.1

func (t *BaseInstance) TableName() string

type BaseModel

type BaseModel struct {
	ID    int               `gorm:"not null;primary_key;AUTO_INCREMENT" json:"id"`
	Ctime int64             `gorm:"bigint;autoCreateTime;comment:创建时间" json:"ctime"`
	Utime int64             `gorm:"bigint;autoUpdateTime;comment:更新时间" json:"utime"`
	Dtime sdelete.DeletedAt `gorm:"bigint;comment:删除时间" json:"dtime"`
}

type BaseTable added in v0.3.1

type BaseTable struct {
	BaseModel

	Did            int    `gorm:"column:did;type:int(11);index:uix_did_name,unique" json:"did"`                // database id
	Name           string `gorm:"column:name;type:varchar(64);NOT NULL;index:uix_did_name,unique" json:"name"` // table
	Typ            int    `gorm:"column:typ;type:int(11)" json:"typ"`                                          // table type, 1 string 2 float
	Days           int    `gorm:"column:days;type:int(11)" json:"days"`                                        // data expire days
	Brokers        string `gorm:"column:brokers;type:varchar(255);NOT NULL" json:"brokers"`                    // kafka broker
	Topic          string `gorm:"column:topic;type:varchar(128);NOT NULL" json:"topic"`                        // kafka topic
	SqlData        string `gorm:"column:sql_data;type:text" json:"sqlData"`                                    // sql_data
	SqlStream      string `gorm:"column:sql_stream;type:text" json:"sqlStream"`                                // sql_stream
	SqlView        string `gorm:"column:sql_view;type:text" json:"sqlView"`                                    // sql_view
	SqlDistributed string `gorm:"column:sql_distributed;type:text" json:"sqlDistributed"`                      // sql_distributed
	Uid            int    `gorm:"column:uid;type:int(11)" json:"uid"`                                          // 操作人
	CreateType     int    `gorm:"column:create_type;type:tinyint(1)" json:"createType"`                        // operation type, 0 means create clickvisual fresh table, 1 means use exists table
	TimeField      string `gorm:"column:time_field;type:varchar(128);NOT NULL" json:"timeField"`               // custom time filed name of _time_
	TimeFieldType  int    `gorm:"column:time_field_type;type:int(11);default:0;NOT NULL" json:"timeFieldType"` // custom time filed type name of _time_
	Desc           string `gorm:"column:desc;type:varchar(255)" json:"desc"`

	Database *BaseDatabase `json:"database,omitempty" gorm:"foreignKey:Did;references:ID"`
}

func TableInfo

func TableInfo(db *gorm.DB, paramId int) (resp BaseTable, err error)

func TableInfoX

func TableInfoX(db *gorm.DB, conds map[string]interface{}) (resp BaseTable, err error)

TableInfoX Info extension method to query a single record according to Cond

func TableList

func TableList(db *gorm.DB, conds egorm.Conds) (resp []*BaseTable, err error)

TableList Get all currently undeleted clusters. Mainly used for front end

func (*BaseTable) GetTimeField added in v0.3.1

func (m *BaseTable) GetTimeField() string

func (*BaseTable) TableName added in v0.3.1

func (m *BaseTable) TableName() string

type BaseView added in v0.3.1

type BaseView struct {
	BaseModel

	Tid              int    `gorm:"column:tid;type:bigint(11);index:uix_tid_name,unique" json:"tid"`             // table id
	Name             string `gorm:"column:name;type:varchar(64);NOT NULL;index:uix_tid_name,unique" json:"name"` // view name
	IsUseDefaultTime int    `gorm:"column:is_use_default_time;type:int(11)" json:"isUseDefaultTime"`             // use system time or not
	Key              string `gorm:"column:key;type:varchar(64);NOT NULL" json:"key"`                             // field name of time in raw log
	Format           string `gorm:"column:format;type:varchar(64);NOT NULL" json:"format"`                       // timestamp parse to extract time from raw log and parse it to datetime
	SqlView          string `gorm:"column:sql_view;type:text" json:"sqlView"`                                    // sql_view
	Uid              int    `gorm:"column:uid;type:int(11)" json:"uid"`                                          // operator uid
}

BaseView Materialized view management

func ViewInfo

func ViewInfo(db *gorm.DB, paramId int) (resp BaseView, err error)

func ViewInfoX

func ViewInfoX(conds map[string]interface{}) (resp BaseView, err error)

ViewInfoX Info extension method to query a single record according to Cond

func ViewList

func ViewList(db *gorm.DB, conds egorm.Conds) (resp []*BaseView, err error)

ViewList Get all currently undeleted clusters. Mainly used for front end

func (*BaseView) TableName added in v0.3.1

func (m *BaseView) TableName() string

type BigdataCrontab added in v0.3.2

type BigdataCrontab struct {
	NodeId        int    `gorm:"column:node_id;type:int(11);uix_node_id,unique" json:"nodeId"`
	Desc          string `gorm:"column:desc;type:varchar(255);NOT NULL" json:"desc"` // description
	DutyUid       int    `gorm:"column:duty_uid;type:int(11)" json:"dutyUid"`        // person in charge
	Cron          string `gorm:"column:cron;type:varchar(255);NOT NULL" json:"cron"` // cron expression
	Typ           int    `gorm:"column:typ;type:int(11)" json:"typ"`                 // typ 0 Normal scheduling 1 Suspended scheduling
	Status        int    `gorm:"column:status;type:int(11)" json:"status"`           // status 0 default 1 preempt 2 doing
	Uid           int    `gorm:"column:uid;type:int(11)" json:"uid"`                 // user id
	Args          string `gorm:"args:sql_view;type:text" json:"args"`                // sql_view
	IsRetry       int    `gorm:"column:is_retry;type:tinyint(1)" json:"isRetry"`
	RetryTimes    int    `gorm:"column:retry_times;type:int(11)" json:"retryTimes"`
	RetryInterval int    `gorm:"column:retry_interval;type:int(11)" json:"retryInterval"`
	Ctime         int64  `gorm:"bigint;autoCreateTime;comment:创建时间" json:"ctime"`
	Utime         int64  `gorm:"bigint;autoUpdateTime;comment:更新时间" json:"utime"`
}

func CrontabInfo added in v0.3.2

func CrontabInfo(db *gorm.DB, nodeId int) (resp BigdataCrontab, err error)

func CrontabList added in v0.3.2

func CrontabList(conds egorm.Conds) (resp []*BigdataCrontab, err error)

func (*BigdataCrontab) TableName added in v0.3.2

func (m *BigdataCrontab) TableName() string

type BigdataDepend added in v0.3.2

type BigdataDepend struct {
	Iid                  int     `gorm:"column:iid;type:int(11);index:uix_iid_database_table,unique" json:"iid"`
	Database             string  `gorm:"column:database;type:varchar(128);index:uix_iid_database_table,unique;NOT NULL" json:"database"`
	Table                string  `gorm:"column:table;type:varchar(128);index:uix_iid_database_table,unique;NOT NULL" json:"table"`
	Engine               string  `gorm:"column:engine;type:varchar(128);NOT NULL" json:"engine"`
	DownDepDatabaseTable Strings `gorm:"column:down_dep_database_table;type:text;NOT NULL" json:"downDepDatabaseTable"`
	UpDepDatabaseTable   Strings `gorm:"column:up_dep_database_table;type:text;NOT NULL" json:"upDepDatabaseTable"`
	Rows                 uint64  `gorm:"column:rows;type:bigint(20);default:0;NOT NULL" json:"rows"`
	Bytes                uint64  `gorm:"column:bytes;type:bigint(20);default:0;NOT NULL" json:"bytes"`

	Utime int64 `gorm:"bigint;autoUpdateTime;comment:更新时间" json:"utime"`
}

func DependsInfo added in v0.3.2

func DependsInfo(db *gorm.DB, id int) (resp BigdataDepend, err error)

func DependsInfoX added in v0.3.2

func DependsInfoX(conds map[string]interface{}) (resp BigdataDepend, err error)

func DependsList added in v0.3.2

func DependsList(conds egorm.Conds) (resp []*BigdataDepend, err error)

func DependsUpsList added in v0.3.2

func DependsUpsList(db *gorm.DB, iid int, database, table string) (resp []*BigdataDepend, err error)

func (*BigdataDepend) Key added in v0.3.2

func (m *BigdataDepend) Key() string

func (*BigdataDepend) Name added in v0.3.2

func (m *BigdataDepend) Name() string

func (*BigdataDepend) TableName added in v0.3.2

func (m *BigdataDepend) TableName() string

type BigdataFolder added in v0.3.1

type BigdataFolder struct {
	BaseModel

	Uid        int    `gorm:"column:uid;type:int(11)" json:"uid"` // uid of alarm operator
	Iid        int    `gorm:"column:iid;type:int(11)" json:"iid"`
	Name       string `gorm:"column:name;type:varchar(128);NOT NULL" json:"name"` // name of an alarm
	Desc       string `gorm:"column:desc;type:varchar(255);NOT NULL" json:"desc"` // description
	Primary    int    `gorm:"column:primary;type:int(11)" json:"primary"`
	Secondary  int    `gorm:"column:secondary;type:int(11)" json:"secondary"`
	WorkflowId int    `gorm:"column:workflow_id;type:int(11)" json:"workflowId"`
	ParentId   int    `gorm:"column:parent_id;type:int(11)" json:"parentId"`
}

func FolderInfo added in v0.3.1

func FolderInfo(db *gorm.DB, id int) (resp BigdataFolder, err error)

func FolderList added in v0.3.1

func FolderList(conds egorm.Conds) (resp []*BigdataFolder, err error)

func (*BigdataFolder) TableName added in v0.3.1

func (m *BigdataFolder) TableName() string

type BigdataNode added in v0.3.1

type BigdataNode struct {
	BaseModel

	Uid        int    `gorm:"column:uid;type:int(11)" json:"uid"`
	Iid        int    `gorm:"column:iid;type:int(11)" json:"iid"`
	FolderID   int    `gorm:"column:folder_id;type:int(11)" json:"folderId"`
	Primary    int    `gorm:"column:primary;type:int(11)" json:"primary"`
	Secondary  int    `gorm:"column:secondary;type:int(11)" json:"secondary"`
	Tertiary   int    `gorm:"column:tertiary;type:int(11)" json:"tertiary"`
	WorkflowId int    `gorm:"column:workflow_id;type:int(11)" json:"workflowId"`
	SourceId   int    `gorm:"column:sourceId;type:int(11)" json:"sourceId"`
	Name       string `gorm:"column:name;type:varchar(128);NOT NULL" json:"name"`
	Desc       string `gorm:"column:desc;type:varchar(255);NOT NULL" json:"desc"`
	LockUid    int    `gorm:"column:lock_uid;type:int(11) unsigned" json:"lockUid"`
	LockAt     int64  `gorm:"column:lock_at;type:int(11)" json:"lockAt"`
	Status     int    `gorm:"column:status;type:int(11)" json:"status"` // 0 无状态 1 待执行 2 执行中 3 执行异常 4 执行完成
	UUID       string `gorm:"column:uuid;type:varchar(128)" json:"uuid"`
}

func NodeInfo added in v0.3.1

func NodeInfo(db *gorm.DB, id int) (resp BigdataNode, err error)

func NodeList added in v0.3.1

func NodeList(conds egorm.Conds) (resp []*BigdataNode, err error)

func (*BigdataNode) TableName added in v0.3.1

func (m *BigdataNode) TableName() string

type BigdataNodeContent added in v0.3.1

type BigdataNodeContent struct {
	NodeId          int    `gorm:"column:node_id;type:int(11);uix_node_id,unique" json:"nodeId"`
	Content         string `gorm:"column:content;type:longtext" json:"content"`
	Result          string `gorm:"column:result;type:longtext" json:"result"`
	PreviousContent string `gorm:"column:previous_content;type:longtext" json:"previousContent"`
	Utime           int64  `gorm:"bigint;autoUpdateTime;comment:update time" json:"utime"`
}

func NodeContentInfo added in v0.3.1

func NodeContentInfo(db *gorm.DB, id int) (resp BigdataNodeContent, err error)

func (*BigdataNodeContent) TableName added in v0.3.1

func (m *BigdataNodeContent) TableName() string

type BigdataNodeHistory added in v0.3.1

type BigdataNodeHistory struct {
	UUID    string `gorm:"column:uuid;type:varchar(128);uix_uuid,unique" json:"uuid"`
	NodeId  int    `gorm:"column:node_id;type:int(11)" json:"nodeId"`
	Content string `gorm:"column:content;type:longtext" json:"content"`
	Uid     int    `gorm:"column:uid;type:int(11)" json:"uid"`
	Utime   int64  `gorm:"bigint;autoUpdateTime;comment:update time" json:"utime"`
}

func NodeHistoryInfo added in v0.3.1

func NodeHistoryInfo(db *gorm.DB, uuid string) (resp BigdataNodeHistory, err error)

func NodeHistoryListPage added in v0.3.1

func NodeHistoryListPage(conds egorm.Conds, reqList *ReqPage) (total int64, respList []*BigdataNodeHistory)

func (*BigdataNodeHistory) TableName added in v0.3.1

func (m *BigdataNodeHistory) TableName() string

type BigdataNodeResult added in v0.3.2

type BigdataNodeResult struct {
	BaseModel

	NodeId       int    `gorm:"column:node_id;type:int(11)" json:"nodeId"`
	Content      string `gorm:"column:content;type:longtext" json:"content"`
	Result       string `gorm:"column:result;type:longtext" json:"result"`
	ExcelProcess string `gorm:"column:excel_process;type:longtext" json:"excelProcess"`
	Uid          int    `gorm:"column:uid;type:int(11)" json:"uid"`
	Cost         int64  `gorm:"column:cost;type:bigint(20)" json:"cost"` // ms
}

func NodeResultInfo added in v0.3.2

func NodeResultInfo(db *gorm.DB, id int) (resp BigdataNodeResult, err error)

func NodeResultList added in v0.3.2

func NodeResultList(conds egorm.Conds) (resp []*BigdataNodeResult, err error)

func NodeResultListPage added in v0.3.2

func NodeResultListPage(conds egorm.Conds, reqList *ReqPage) (total int64, respList []*BigdataNodeResult)

func (*BigdataNodeResult) TableName added in v0.3.2

func (m *BigdataNodeResult) TableName() string

type BigdataSource added in v0.3.1

type BigdataSource struct {
	BaseModel

	Iid      int    `gorm:"column:iid;type:int(11)" json:"iid"`
	Name     string `gorm:"column:name;type:varchar(128);NOT NULL" json:"name"` // name of an alarm
	Desc     string `gorm:"column:desc;type:varchar(255);NOT NULL" json:"desc"` // description
	URL      string `gorm:"column:url;type:varchar(255);NOT NULL" json:"url"`
	UserName string `gorm:"column:username;type:varchar(255);NOT NULL" json:"username"`
	Password string `gorm:"column:password;type:varchar(255);NOT NULL" json:"password"`
	Typ      int    `gorm:"column:typ;type:int(11)" json:"typ"`
	Uid      int    `gorm:"column:uid;type:int(11)" json:"uid"`
}

func SourceInfo added in v0.3.1

func SourceInfo(db *gorm.DB, id int) (resp BigdataSource, err error)

func SourceList added in v0.3.1

func SourceList(conds egorm.Conds) (resp []*BigdataSource, err error)

func (*BigdataSource) TableName added in v0.3.1

func (m *BigdataSource) TableName() string

type BigdataWorkflow added in v0.3.1

type BigdataWorkflow struct {
	BaseModel

	Iid  int    `gorm:"column:iid;type:int(11)" json:"iid"`
	Name string `gorm:"column:name;type:varchar(128);NOT NULL" json:"name"` // name of an alarm
	Desc string `gorm:"column:desc;type:varchar(255);NOT NULL" json:"desc"` // description
	Uid  int    `gorm:"column:uid;type:int(11)" json:"uid"`
}

func WorkflowInfo added in v0.3.1

func WorkflowInfo(db *gorm.DB, id int) (resp BigdataWorkflow, err error)

func WorkflowList added in v0.3.1

func WorkflowList(conds egorm.Conds) (resp []*BigdataWorkflow, err error)

func (*BigdataWorkflow) TableName added in v0.3.1

func (m *BigdataWorkflow) TableName() string

type CasbinRules

type CasbinRules []*PmsCasbinRule

type Cluster

type Cluster struct {
	BaseModel

	Name        string `gorm:"column:name;type:varchar(255);NOT NULL;index:uix_cluster_name,unique" json:"clusterName"` // unique name of cluster
	Description string `gorm:"column:description;type:varchar(128)" json:"description"`                                 // brief description of cluster
	Status      int    `gorm:"column:status;type:tinyint(1)" json:"status"`                                             // 0 means Well-Running, others mean not running
	ApiServer   string `gorm:"column:api_server;type:varchar(255);NOT NULL" json:"apiServer"`                           // address of cluster API server
	KubeConfig  string `gorm:"column:kube_config;type:mediumtext;NOT NULL" json:"kubeConfig"`                           // raw content of kube config
}

func ClusterInfo

func ClusterInfo(paramId int) (resp Cluster, err error)

func ClusterInfoX

func ClusterInfoX(db *gorm.DB, conds map[string]interface{}) (resp Cluster, err error)

ClusterInfoX get single item by condition

func ClusterList

func ClusterList(conds egorm.Conds) (resp []*Cluster, err error)

ClusterList return item list by condition

func ClusterListHideSensitiveInfo

func ClusterListHideSensitiveInfo(conds egorm.Conds) (resp []*Cluster, err error)

func ClusterListPage

func ClusterListPage(conds egorm.Conds, reqList *ReqPage) (total int64, respList []*Cluster)

ClusterListPage return item list by pagination

func ClusterNormalInfo

func ClusterNormalInfo(paramId int) (resp Cluster, err error)

func ClusterNormalList

func ClusterNormalList(conds egorm.Conds) (resp []*Cluster, err error)

func GetAllNormalClusters

func GetAllNormalClusters() (result []*Cluster, err error)

GetAllNormalClusters 获取当前所有未删除且状态正常的clusters; 主要供后端调用.

func (*Cluster) Key

func (m *Cluster) Key() string

func (*Cluster) TableName

func (m *Cluster) TableName() string

type Cond

type Cond struct {
	// Op MySQL中查询条件,如like,=,in
	Op string
	// Val 查询条件对应的值
	Val interface{}
}

Cond 为字段查询结构体

type Conds

type Conds map[string]interface{}

Conds 为Cond类型map,用于定义Where方法参数 map[field.name]interface{}

type Configuration

type Configuration struct {
	BaseModel

	K8SCmId     int    `gorm:"column:k8s_cm_id;type:int(11);" json:"k8sConfigmapId"` // config map id
	Name        string `gorm:"column:name;type:varchar(64);" json:"name"`
	Content     string `gorm:"column:content;type:longtext" json:"content"`
	Format      string `gorm:"column:format;type:varchar(32)" json:"format"`
	Version     string `gorm:"column:version;type:varchar(64)" json:"version"`
	Uid         int    `gorm:"column:uid;type:int(11) unsigned" json:"uid"`
	PublishTime int64  `gorm:"column:publish_time;type:int(11)" json:"publishTime"`
	LockUid     int    `gorm:"column:lock_uid;type:int(11) unsigned" json:"lockUid"`
	LockAt      int64  `gorm:"column:lock_at;type:bigint(11) unsigned" json:"lockAt"`

	K8SConfigMap K8SConfigMap `gorm:"foreignKey:K8SCmId;references:ID" json:"-"`
}

func ConfigurationInfo

func ConfigurationInfo(paramId int) (resp Configuration, err error)

func ConfigurationInfoX

func ConfigurationInfoX(conds map[string]interface{}) (resp Configuration, err error)

ConfigurationInfoX Info extension method to query a single record according to Cond

func ConfigurationList

func ConfigurationList(conds egorm.Conds) (resp []*Configuration, err error)

ConfigurationList return item list by condition

func ConfigurationListPage

func ConfigurationListPage(conds egorm.Conds, reqList *ReqPage) (total int64, respList []*Configuration)

ConfigurationListPage return item list by pagination

func (Configuration) FileName

func (c Configuration) FileName() string

FileName ..

func (*Configuration) TableName

func (c *Configuration) TableName() string

type ConfigurationHistory

type ConfigurationHistory struct {
	BaseModel
	Uid             int    `gorm:"column:uid;type:int(11) unsigned" json:"uid"`
	ConfigurationId int    `gorm:"column:configuration_id;type:int(11) unsigned" json:"configurationId"`
	ChangeLog       string `gorm:"column:change_log;type:longtext" json:"changeLog"`
	Content         string `gorm:"column:content;type:longtext" json:"content"`
	Version         string `gorm:"column:version;type:varchar(64)" json:"version"`

	Configuration Configuration `json:"configuration,omitempty" gorm:"foreignKey:ConfigurationId;references:ID"`
}

func ConfigurationHistoryInfo

func ConfigurationHistoryInfo(paramId int) (resp ConfigurationHistory, err error)

func ConfigurationHistoryInfoX

func ConfigurationHistoryInfoX(conds map[string]interface{}) (resp ConfigurationHistory, err error)

ConfigurationHistoryInfoX get single item by condition

func ConfigurationHistoryList

func ConfigurationHistoryList(conds egorm.Conds) (resp []*ConfigurationHistory, err error)

ConfigurationHistoryList return item list by condition

func ConfigurationHistoryListPage

func ConfigurationHistoryListPage(conds egorm.Conds, reqList *ReqPage) (total int64, respList []*ConfigurationHistory)

ConfigurationHistoryListPage return item list by pagination

func (*ConfigurationHistory) TableName

func (m *ConfigurationHistory) TableName() string

type ConfigurationPublish

type ConfigurationPublish struct {
	BaseModel

	Uid                    uint `gorm:"column:uid;type:int(11) unsigned" json:"uid"`
	ConfigurationId        uint `gorm:"column:configuration_id;type:int(11) unsigned" json:"configurationId"`
	ConfigurationHistoryId uint `gorm:"column:configuration_history_id;type:int(11) unsigned" json:"configurationHistoryId"`
}

func ConfigurationPublishInfo

func ConfigurationPublishInfo(paramId int) (resp ConfigurationPublish, err error)

func ConfigurationPublishList

func ConfigurationPublishList(conds egorm.Conds) (resp []*ConfigurationPublish, err error)

ConfigurationPublishList return item list by condition

func ConfigurationPublishListPage

func ConfigurationPublishListPage(conds egorm.Conds, reqList *ReqPage) (total int64, respList []*ConfigurationPublish)

ConfigurationPublishListPage return item list by pagination

func (*ConfigurationPublish) TableName

func (m *ConfigurationPublish) TableName() string

type Event

type Event struct {
	ID            int    `gorm:"primary_key,not null;AUTO_INCREMENT" json:"id"`
	Source        string `gorm:"not null;default:'';size:64;index:idx_source;comment:事件来源" json:"source"`
	UserName      string `gorm:"not null;default:'';size:32;comment:操作用户的名字" json:"userName"`
	UID           int64  `gorm:"not null;default:0;comment:操作用户的uid" json:"uid"`
	Operation     string `gorm:"not null;default:'';size:64;index:idx_operation;comment:操作名" json:"operation"`
	ObjectType    string `gorm:"not null;default:'';size:64;comment:被操作对象的类型(一般为db.Table名)" json:"objectType"`
	ObjectId      int    `gorm:"not null;default:0;comment:被操作对象类型(db.BaseTable)下的具体对象的主键(id)" json:"objectId"`
	Metadata      string `gorm:"not null;type:text;comment:事件内容" json:"metadata"`
	Ctime         int64  `gorm:"bigint;autoCreateTime;comment:创建时间" json:"ctime"`
	OperationName string `gorm:"-" json:"operationName"`
	SourceName    string `gorm:"-" json:"sourceName"`
}

func (*Event) HandleOperationName

func (a *Event) HandleOperationName()

func (*Event) HandleSourceName

func (a *Event) HandleSourceName()

func (Event) TableName

func (Event) TableName() string

type Ints

type Ints []int

func (*Ints) Scan

func (t *Ints) Scan(input interface{}) error

func (Ints) Value

func (t Ints) Value() (driver.Value, error)

type K8SConfigMap

type K8SConfigMap struct {
	BaseModel

	ClusterId int    `gorm:"column:cluster_id;type:int(11);index:uix_cluster_id_name_namespace,unique" json:"clusterId"` // 集群ID
	Name      string `gorm:"column:name;type:varchar(128);index:uix_cluster_id_name_namespace,unique" json:"name"`
	Namespace string `gorm:"column:namespace;type:varchar(64);index:uix_cluster_id_name_namespace,unique" json:"namespace"`
}

func K8SConfigMapInfo

func K8SConfigMapInfo(paramId int) (resp K8SConfigMap, err error)

func K8SConfigMapInfoX

func K8SConfigMapInfoX(conds map[string]interface{}) (resp K8SConfigMap, err error)

K8SConfigMapInfoX get single item by condition

func K8SConfigMapList

func K8SConfigMapList(conds egorm.Conds) (resp []*K8SConfigMap, err error)

K8SConfigMapList return item list by condition

func K8SConfigMapListPage

func K8SConfigMapListPage(conds egorm.Conds, reqList *ReqPage) (total int64, respList []*K8SConfigMap)

K8SConfigMapListPage return item list by pagination

func K8SConfigMapListX

func K8SConfigMapListX(conds map[string]interface{}) (resp []K8SConfigMap, err error)

K8SConfigMapListX get single item by condition

func K8SConfigMapLoadOrSave

func K8SConfigMapLoadOrSave(db *gorm.DB, data *K8SConfigMap) (resp *K8SConfigMap, err error)

func (*K8SConfigMap) TableName

func (m *K8SConfigMap) TableName() string

type OAuthToken

type OAuthToken struct {
	*oauth2.Token
}

func (*OAuthToken) Scan

func (t *OAuthToken) Scan(input interface{}) error

func (OAuthToken) Value

func (t OAuthToken) Value() (driver.Value, error)

type PmsCasbinRule

type PmsCasbinRule struct {
	Id    uint   `gorm:"column:id;not null;primaryKey;autoIncrement;comment:'id'" json:"id" form:"id"`
	Ptype string `gorm:"column:ptype;not null;type:varchar(100);comment:'ptype: value in [p, g, g2, g3]'" json:"ptype" form:"ptype"`
	V0    string `gorm:"column:v0;not null;type:varchar(100);comment:'sub'" json:"v0" form:"v0"`
	V1    string `gorm:"column:v1;not null;type:varchar(100);comment:'obj'" json:"v1" form:"v1"`
	V2    string `gorm:"column:v2;not null;type:varchar(100);comment:'act'" json:"v2" form:"v2"`
	V3    string `gorm:"column:v3;not null;type:varchar(100);comment:'dom'" json:"v3" form:"v3"`
	V4    string `gorm:"column:v4;not null;type:varchar(25);comment:'reserved'" json:"v4" form:"v4"`
	V5    string `gorm:"column:v5;not null;type:varchar(25);comment:'reserved'" json:"v5" form:"v5"`
}

func (*PmsCasbinRule) TableName

func (t *PmsCasbinRule) TableName() string

type PmsCustomRole

type PmsCustomRole struct {
	BaseModel
	BelongType   string  `gorm:"not null;size:50;comment:所属资源类型,如'app'" json:"belong_type"`
	ReferId      int     `gorm:"not null;comment:所属资源类型的对应资源id" json:"refer_id"`
	RoleName     string  `gorm:"not null;size:50;comment:所属对应资源的角色名称" json:"role_name"`
	Description  string  `gorm:"not null;size:255;default:'';comment:对角色的中文描述" json:"description"`
	SubResources Strings `gorm:"not null;type:json;comment:角色所属refer_id资源的子资源列表" json:"sub_resources"`
	Acts         Strings `gorm:"not null;type:json;comment:对资源列表中各资源的actions" json:"acts"`
	UpdatedBy    int     `gorm:"not null;default:0;comment:最近一次对记录做更新的用户id" json:"updated_by"`
}
PmsCustomRole: 对资源的自定义角色表; 该表记录的增删会实时反映到 casbin_rule表中 (那么为什么不直接用casbin_rule表去维护?

因为, casbin_rule表中没有description描述, 该表的作用是供app负责人自定义一些在default_role_pms之外的一些角色.)

note: 1. 需要保证 belong_type, refer_id, role_name, resources, act 这5个字段建立联合唯一索引.
	     但由于resources字段是json类型, 不能用于uniqueIndex, 所以需要代码去保证这5个字段的uniqueIndex
	  2. 是否支持custom_role_pms的自定义, 需要看当前代码实现, 目前支持的belong_type 为 ["app"]

func GetCustomRolePmsList

func GetCustomRolePmsList(conds Conds) (resp []*PmsCustomRole, err error)

func (*PmsCustomRole) TableName

func (t *PmsCustomRole) TableName() string

type PmsDefaultRole

type PmsDefaultRole struct {
	BaseModel

	BelongType   string  `gorm:"column:belong_type;not null;size:50;comment:所属资源类型,如'app'" json:"belongType"`
	RoleName     string  `gorm:"column:role_name;not null;size:50;comment:所属资源的角色名称" json:"roleName"`
	Description  string  `gorm:"column:description;not null;size:255;default:'';comment:对角色的中文描述" json:"description"`
	SubResources Strings `gorm:"column:sub_resources;not null;type:json;comment:角色所属belongType资源下的子资源列表" json:"subResources"`
	Acts         Strings `gorm:"column:acts;not null;type:json;comment:对资源列表中各资源的actions" json:"acts"`
	UpdatedBy    int     `gorm:"column:updated_by;type:int(11);not null;default:0;comment:最近一次对记录做更新的用户id" json:"updatedBy"`
}
	TableDefaultRolePms: 记录belongType资源的默认角色; i.e. 当belongType资源创建时, 会根据该表中的记录去创建对应的casbinRules
	note: 需要保证 belong_type, role_name, resources, act 这4个字段建立联合唯一索引.
		  但由于resources字段是json类型, 不能用于uniqueIndex, TODO: 代码中保证4个字段的uniqueIndex
 		  不能只对belong_type和role_name两个字段设置uniqueIndex, 应为存在belong_type和role_name相同的情况(它们sub_resources不同)

func GetDefaultRolePmsList

func GetDefaultRolePmsList(conds Conds) (resp []*PmsDefaultRole, err error)

func (*PmsDefaultRole) TableName

func (t *PmsDefaultRole) TableName() string

type PmsRole

type PmsRole struct {
	BaseModel

	Name           string           `gorm:"not null;type:varchar(64);column:name;comment:角色英文名,可修改,不唯一" json:"name"`
	Desc           string           `gorm:"not null;type:varchar(128);default:'';column:desc;comment:角色描述" json:"desc"`
	BelongResource string           `` /* 133-byte string literal not displayed */
	RoleType       int              `` /* 152-byte string literal not displayed */
	ResourceId     int              `` /* 161-byte string literal not displayed */
	Details        []*PmsRoleDetail `gorm:"->" json:"details"`
	Refs           []*PmsRoleRef    `gorm:"->" json:"refs"`
}

func GetPmsRoleList

func GetPmsRoleList(conds egorm.Conds) (resp []*PmsRole, err error)

func PmsRoleInfo

func PmsRoleInfo(id int) (resp *PmsRole, err error)

func PmsRoleInfoWithTgtRef

func PmsRoleInfoWithTgtRef(roleId int, belongResource string, resourceId int) (resp *PmsRole, err error)

not contain grant info

func (*PmsRole) GenerateOnePRuleTplByDetail

func (pr *PmsRole) GenerateOnePRuleTplByDetail(roleDetail *PmsRoleDetail) (resp string, err error)

GenerateOnePRuleTplByDetail : Generate a pType casbin policy string based on inputParam(PmsRoleDetail) returned resp(if not empty) like,

role__{{PmsRole:Id}}__{{PmsRole:BelongResource}}__{{ID}},{{PmsRole:BelongResource}}__{{ID}}__subResource__(SubResourceRegex),ActsRegex,*

func (*PmsRole) IsDetailsValid

func (pr *PmsRole) IsDetailsValid() (err error)

func (*PmsRole) TableName

func (pr *PmsRole) TableName() string

type PmsRoleDetail

type PmsRoleDetail struct {
	BaseModel

	PmsRoleId    int     `gorm:"type:int(11);not null;column:pms_role_id;comment:所属pmsRole的id" json:"pmsRoleId"`
	SubResources Strings `gorm:"not null;type:json;column:sub_resources;comment:授权目标资源的子资源列表" json:"subResources"`
	Acts         Strings `gorm:"not null;type:json;column:acts;comment:准许动作列表" json:"acts"`
	RuleTpl      string  `gorm:"not null;type:text;column:rule_tpl;comment:规则模板,用于生成casbin中的p类型规则" json:"-"`
}

PmsRoleDetail uniqueIndex is not support for json column, please make sure (pms_role_id, sub_resources) is unique, and (pms_role_id, acts) is unique.

func GetPmsRoleDetailList

func GetPmsRoleDetailList(conds egorm.Conds) (resp []*PmsRoleDetail, err error)

func (*PmsRoleDetail) TableName

func (prd *PmsRoleDetail) TableName() string

type PmsRoleRef

type PmsRoleRef struct {
	ID        int                `json:"id" gorm:"column:id;type:int;not null;primary_key;auto_increment"`
	PmsRoleId int                `gorm:"not null;column:pms_role_id;uniqueIndex:uix_role_ref;comment:已存在的角色(pms_role)的Id" json:"pmsRoleId"`
	RefId     int                `gorm:"not null;column:ref_id;uniqueIndex:uix_role_ref;comment:角色belongResource类型对象的id" json:"refId"`
	Grants    []*PmsRoleRefGrant `gorm:"->" json:"-"`
}

PmsRoleRef the table to store the assignment states of every PmsRole. Note, add or delete one record, must create or remove corresponding p rules(which generated from details)

func GetPmsRoleRefInfo

func GetPmsRoleRefInfo(conds egorm.Conds) (resp PmsRoleRef, err error)

func GetPmsRoleRefList

func GetPmsRoleRefList(conds egorm.Conds, withGrants ...bool) (resp []*PmsRoleRef, err error)

for resp, default do not contain grants info

func (*PmsRoleRef) TableName

func (prf *PmsRoleRef) TableName() string

type PmsRoleRefGrant

type PmsRoleRefGrant struct {
	ID           int    `gorm:"column:id;type:int;not null;primary_key;auto_increment" json:"id" `
	PmsRoleRefId int    `gorm:"not null;column:pms_role_ref_id;uniqueIndex:uix_ref_obj_domain;comment:所关联pms_role_ref的Id" json:"pmsRoleRefId"`
	Ptype        string `` /* 135-byte string literal not displayed */
	ObjectType   string `` /* 155-byte string literal not displayed */
	ObjectId     int    `gorm:"not null;column:object_id;uniqueIndex:uix_ref_obj_domain;comment:被授权对象的id" json:"objectId,omitempty"`
	DomainType   string `` /* 164-byte string literal not displayed */
	DomainId     int    `` /* 151-byte string literal not displayed */
}

PmsRoleRefGrant Note, all columns can NOT be modified after crated. if want to modify, please, remove and add again. add or delete record, must create or remove corresponding gType rules

func (*PmsRoleRefGrant) TableName

func (prfg *PmsRoleRefGrant) TableName() string

type ReqPage

type ReqPage struct {
	Current  int `json:"current" form:"current"`
	PageSize int `json:"pageSize" form:"pageSize"`
}

func (*ReqPage) Valid

func (r *ReqPage) Valid() error

type RespAllEnums

type RespAllEnums struct {
	SourceEnums    map[string]string `json:"sourceEnums"`
	OperationEnums map[string]string `json:"operationEnums"`
	UserEnums      map[int]string    `json:"userEnums"`
}

type RespEnumsOfSource

type RespEnumsOfSource struct {
	TargetSource   string            `json:"targetSource"`
	OperationEnums map[string]string `json:"operationEnums"`
}

type String2String

type String2String map[string]string

func (*String2String) Scan

func (t *String2String) Scan(input interface{}) error

func (String2String) Value

func (t String2String) Value() (driver.Value, error)

type Strings

type Strings []string

func (*Strings) Scan

func (t *Strings) Scan(input interface{}) error

func (Strings) Value

func (t Strings) Value() (driver.Value, error)

type UnitItem

type UnitItem struct {
	Alias    string        `json:"alias"`
	Duration time.Duration `json:"duration"`
}

type Ups

type Ups = map[string]interface{}

Ups 为更新某一条记录时存放的变更数据集合 map[field.name]field.value

type User

type User struct {
	BaseModel
	Uid              int        `gorm:"-" json:"uid"`
	OaId             int64      `gorm:"column:oa_id;type:bigint(20);NOT NULL" json:"oaId"`                           // oa_id
	Username         string     `gorm:"column:username;type:varchar(256);NOT NULL" json:"username"`                  // 用户名
	Nickname         string     `gorm:"column:nickname;type:varchar(256);NOT NULL" json:"nickname"`                  // 昵称
	Secret           string     `gorm:"column:secret;type:varchar(256);NOT NULL" json:"secret"`                      // 实例名称
	Email            string     `gorm:"column:email;type:varchar(64);NOT NULL" json:"email"`                         // email
	Avatar           string     `gorm:"column:avatar;type:varchar(256);NOT NULL" json:"avatar"`                      // avatar
	Hash             string     `gorm:"column:hash;type:varchar(256);NOT NULL" json:"hash"`                          // hash
	WebUrl           string     `gorm:"column:web_url;type:varchar(256);NOT NULL" json:"webUrl"`                     // webUrl
	Oauth            string     `gorm:"column:oauth;type:varchar(256);NOT NULL" json:"oauth"`                        // oauth
	State            string     `gorm:"column:state;type:varchar(256);NOT NULL" json:"state"`                        // state
	OauthId          string     `gorm:"column:oauth_id;type:varchar(256);NOT NULL" json:"oauthId"`                   // oauthId
	Password         string     `gorm:"column:password;type:varchar(256);NOT NULL" json:"password"`                  // password
	CurrentAuthority string     `gorm:"column:current_authority;type:varchar(256);NOT NULL" json:"currentAuthority"` // currentAuthority
	Access           string     `gorm:"column:access;type:varchar(256);NOT NULL" json:"access"`                      // access
	OauthToken       OAuthToken `gorm:"column:oauth_token;type:text" json:"-"`                                       // oauth_token
}

func UserInfo

func UserInfo(paramId int) (resp User, err error)

func UserInfoX

func UserInfoX(conds map[string]interface{}) (resp User, err error)

UserInfoX get single item by condition

func UserList

func UserList(conds egorm.Conds) (resp []*User, err error)

UserList return item list by condition

func UserListPage

func UserListPage(conds egorm.Conds, reqList *ReqPage) (total int64, respList []*User)

UserListPage return item list by pagination

func (User) TableName

func (User) TableName() string

type UserIdName

type UserIdName struct {
	ID       int
	Username string
}

Jump to

Keyboard shortcuts

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