重新初始化仓库
This commit is contained in:
		
							
								
								
									
										34
									
								
								define/config/database.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								define/config/database.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,34 @@
 | 
			
		||||
// Package config.sql ...
 | 
			
		||||
//
 | 
			
		||||
// Author : go_developer@163.com<白茶清欢>
 | 
			
		||||
//
 | 
			
		||||
// Date : 6:55 下午 2021/8/7
 | 
			
		||||
package config
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"git.zhangdeman.cn/zhangdeman/gopkg/logger"
 | 
			
		||||
	"git.zhangdeman.cn/zhangdeman/gopkg/middleware/mysql"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Database 数据库配置
 | 
			
		||||
//
 | 
			
		||||
// Author : go_developer@163.com<白茶清欢>
 | 
			
		||||
//
 | 
			
		||||
// Date : 6:55 下午 2021/8/7
 | 
			
		||||
type Database struct {
 | 
			
		||||
	DB  *mysql.DBConfig `json:"db" yaml:"db"`
 | 
			
		||||
	Log *DBLog          `json:"log" yaml:"log"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DBLog 数据库日志配置
 | 
			
		||||
//
 | 
			
		||||
// Author : go_developer@163.com<白茶清欢>
 | 
			
		||||
//
 | 
			
		||||
// Date : 7:04 下午 2021/8/7
 | 
			
		||||
type DBLog struct {
 | 
			
		||||
	Level            int                     `json:"level" yaml:"level"`
 | 
			
		||||
	Console          bool                    `json:"console" yaml:"console"`
 | 
			
		||||
	TraceFieldName   string                  `json:"trace_field_name" yaml:"trace_field_name"`
 | 
			
		||||
	ExtractFieldList []string                `json:"extract_field_list" yaml:"extract_field_list"`
 | 
			
		||||
	Split            *logger.RotateLogConfig `json:"split" yaml:"split"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										22
									
								
								define/form/config.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								define/form/config.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,22 @@
 | 
			
		||||
// Package form...
 | 
			
		||||
//
 | 
			
		||||
// Description : form...
 | 
			
		||||
//
 | 
			
		||||
// Author : go_developer@163.com<白茶清欢>
 | 
			
		||||
//
 | 
			
		||||
// Date : 2021-08-09 10:13 下午
 | 
			
		||||
package form
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdateConfig 创建/更新配置表单
 | 
			
		||||
//
 | 
			
		||||
// Author : go_developer@163.com<白茶清欢>
 | 
			
		||||
//
 | 
			
		||||
// Date : 10:15 下午 2021/8/9
 | 
			
		||||
type CreateOrUpdateConfig struct {
 | 
			
		||||
	NamespaceID   int64  `json:"namespace_id"`    // 命名空间ID
 | 
			
		||||
	Namespace     string `json:"namespace"`       // 命名空间
 | 
			
		||||
	Key           string `json:"key"`             // 配置的key
 | 
			
		||||
	Value         string `json:"value"`           // 配置的值
 | 
			
		||||
	OperateUserID string `json:"operate_user_id"` // 操作人ID
 | 
			
		||||
	Description   string `json:"description"`     // 配置描述
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										31
									
								
								define/form/namespace.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								define/form/namespace.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,31 @@
 | 
			
		||||
// Package form...
 | 
			
		||||
//
 | 
			
		||||
// Description : 命名空间操作相关表单
 | 
			
		||||
//
 | 
			
		||||
// Author : go_developer@163.com<白茶清欢>
 | 
			
		||||
//
 | 
			
		||||
// Date : 2021-08-09 2:19 下午
 | 
			
		||||
package form
 | 
			
		||||
 | 
			
		||||
// CreateNamespace 创建命名空间的表单
 | 
			
		||||
//
 | 
			
		||||
// Author : go_developer@163.com<白茶清欢>
 | 
			
		||||
//
 | 
			
		||||
// Date : 2:19 下午 2021/8/9
 | 
			
		||||
type CreateNamespace struct {
 | 
			
		||||
	Namespace    string `json:"namespace"`      // 要创建的命名空间
 | 
			
		||||
	Name         string `json:"name"`           // 命名空间的名称
 | 
			
		||||
	Description  string `json:"description"`    // 命名空间的描述
 | 
			
		||||
	CreateUserID string `json:"create_user_id"` // 创建人ID
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ActiveNamespace 激活命名空间
 | 
			
		||||
//
 | 
			
		||||
// Author : go_developer@163.com<白茶清欢>
 | 
			
		||||
//
 | 
			
		||||
// Date : 9:17 下午 2021/8/9
 | 
			
		||||
type ActiveNamespace struct {
 | 
			
		||||
	NamespaceID  int64  `json:"namespace_id"`   // 命名空间ID
 | 
			
		||||
	Namespace    string `json:"namespace"`      // 命名空间
 | 
			
		||||
	UpdateUserID string `json:"update_user_id"` // 更新的用户ID
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										28
									
								
								define/model/config.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								define/model/config.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,28 @@
 | 
			
		||||
// Package model ...
 | 
			
		||||
//
 | 
			
		||||
// Author : go_developer@163.com<白茶清欢>
 | 
			
		||||
//
 | 
			
		||||
// Date : 10:21 下午 2021/8/8
 | 
			
		||||
package model
 | 
			
		||||
 | 
			
		||||
// Config 配置的数据结构
 | 
			
		||||
//
 | 
			
		||||
// Author : go_developer@163.com<白茶清欢>
 | 
			
		||||
//
 | 
			
		||||
// Date : 10:22 下午 2021/8/8
 | 
			
		||||
type Config struct {
 | 
			
		||||
	ID           int64  `gorm:"column:id;primary_key;AUTO_INCREMENT" json:"id"`                           // 命名空间ID
 | 
			
		||||
	NamespaceID  int64  `gorm:"column:namespace_id;default:0;NOT NULL" json:"namespace_id"`               // 命名空间ID
 | 
			
		||||
	Field        string `gorm:"column:field;NOT NULL" json:"field"`                                       // 配置字段
 | 
			
		||||
	Value        string `gorm:"column:value;NOT NULL" json:"value"`                                       // 配置值
 | 
			
		||||
	Description  string `gorm:"column:description;NOT NULL" json:"description"`                           // 配置描述
 | 
			
		||||
	CreateUserID string `gorm:"column:create_user_id;default:0;NOT NULL" json:"create_user_id"`           // 创建人ID
 | 
			
		||||
	ModifyUserID string `gorm:"column:modify_user_id;default:0;NOT NULL" json:"modify_user_id"`           // 修改人ID
 | 
			
		||||
	CreateTime   string `gorm:"column:create_time;default:CURRENT_TIMESTAMP;NOT NULL" json:"create_time"` // 创建时间
 | 
			
		||||
	ModifyTime   string `gorm:"column:modify_time;default:CURRENT_TIMESTAMP;NOT NULL" json:"modify_time"` // 更新时间
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TableName ...
 | 
			
		||||
func (c Config) TableName() string {
 | 
			
		||||
	return "config"
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										48
									
								
								define/model/log.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								define/model/log.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,48 @@
 | 
			
		||||
// Package model ...
 | 
			
		||||
//
 | 
			
		||||
// Author : go_developer@163.com<白茶清欢>
 | 
			
		||||
//
 | 
			
		||||
// Date : 10:21 下午 2021/8/8
 | 
			
		||||
package model
 | 
			
		||||
 | 
			
		||||
// Log 操作日志
 | 
			
		||||
//
 | 
			
		||||
// Author : go_developer@163.com<白茶清欢>
 | 
			
		||||
//
 | 
			
		||||
// Date : 10:21 下午 2021/8/8
 | 
			
		||||
type Log struct {
 | 
			
		||||
	ID           int64  `gorm:"column:id;primary_key;AUTO_INCREMENT" json:"id"`                           // 命名空间ID
 | 
			
		||||
	NamespaceID  int64  `gorm:"column:namespace_id;default:0;NOT NULL" json:"namespace_id"`               // 命名空间ID
 | 
			
		||||
	ConfigID     int64  `gorm:"column:config_id;default:0;NOT NULL" json:"config_id"`                     // 配置ID
 | 
			
		||||
	BeforeValue  string `gorm:"column:before_value;NOT NULL" json:"before_value"`                         // 变更前的值
 | 
			
		||||
	AfterValue   string `gorm:"column:after_value;NOT NULL" json:"after_value"`                           // 变更后的值
 | 
			
		||||
	Description  string `gorm:"column:description;NOT NULL" json:"description"`                           // 变更描述
 | 
			
		||||
	LogType      string `gorm:"column:log_type;default:0;NOT NULL" json:"log_type"`                       // 日志类型
 | 
			
		||||
	CreateUserID string `gorm:"column:create_user_id;default:0;NOT NULL" json:"create_user_id"`           // 创建人ID
 | 
			
		||||
	CreateTime   string `gorm:"column:create_time;default:CURRENT_TIMESTAMP;NOT NULL" json:"create_time"` // 创建时间
 | 
			
		||||
	ModifyTime   string `gorm:"column:modify_time;default:CURRENT_TIMESTAMP;NOT NULL" json:"modify_time"` // 更新时间
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TableName ...
 | 
			
		||||
func (l Log) TableName() string {
 | 
			
		||||
	return "log"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// LogTypeCreateNamespace 新建命名空间
 | 
			
		||||
	LogTypeCreateNamespace = "CREATE_NAMESPACE"
 | 
			
		||||
	// LogTypeActiveNamespace 激活命名空间
 | 
			
		||||
	LogTypeActiveNamespace = "ACTIVE_NAMESPACE"
 | 
			
		||||
	// LogTypeForbiddenNamespace 禁用命名空间
 | 
			
		||||
	LogTypeForbiddenNamespace = "FORBIDDEN_NAMESPACE"
 | 
			
		||||
	// LogTypeCreateConfig 创建配置
 | 
			
		||||
	LogTypeCreateConfig = "CREATE_CONFIG"
 | 
			
		||||
	// LogTypeUpdateConfig 更新配置
 | 
			
		||||
	LogTypeUpdateConfig = "UPDATE_CONFIG"
 | 
			
		||||
	// LogTypeDeleteConfig 删除配置
 | 
			
		||||
	LogTypeDeleteConfig = "DELETE_CONFIG"
 | 
			
		||||
	// LogTypeRollbackUpdateConfig 回滚,并更新配置
 | 
			
		||||
	LogTypeRollbackUpdateConfig = "ROLLBACK_CONFIG_FOR_UPDATE"
 | 
			
		||||
	// LogTypeRollbackCreateConfig 回滚,并恢复一个已被删除的配置
 | 
			
		||||
	LogTypeRollbackCreateConfig = "ROLLBACK_CONFIG_FOR_DELETE"
 | 
			
		||||
)
 | 
			
		||||
							
								
								
									
										32
									
								
								define/model/namespace.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								define/model/namespace.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,32 @@
 | 
			
		||||
package model
 | 
			
		||||
 | 
			
		||||
// Namespace 命名空间
 | 
			
		||||
//
 | 
			
		||||
// Author : go_developer@163.com<白茶清欢>
 | 
			
		||||
//
 | 
			
		||||
// Date : 1:11 下午 2021/8/7
 | 
			
		||||
type Namespace struct {
 | 
			
		||||
	ID           int64  `gorm:"column:id;primary_key;AUTO_INCREMENT" json:"id"`                           // 命名空间ID
 | 
			
		||||
	Namespace    string `gorm:"column:namespace;NOT NULL" json:"namespace"`                               // 命名空间
 | 
			
		||||
	Name         string `gorm:"column:name;NOT NULL" json:"name"`                                         // 命名空间名称
 | 
			
		||||
	Description  string `gorm:"column:description;NOT NULL" json:"description"`                           // 命名空间详细描述
 | 
			
		||||
	Status       int    `gorm:"column:status;default:0;NOT NULL" json:"status"`                           // 空间状态: 0 - 待激活 1 - 正常 2 - 停用
 | 
			
		||||
	CreateUserID string `gorm:"column:create_user_id;default:0;NOT NULL" json:"create_user_id"`           // 创建人ID
 | 
			
		||||
	ModifyUserID string `gorm:"column:modify_user_id;default:0;NOT NULL" json:"modify_user_id"`           // 修改人ID
 | 
			
		||||
	CreateTime   string `gorm:"column:create_time;default:CURRENT_TIMESTAMP;NOT NULL" json:"create_time"` // 创建时间
 | 
			
		||||
	ModifyTime   string `gorm:"column:modify_time;default:CURRENT_TIMESTAMP;NOT NULL" json:"modify_time"` // 更新时间
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TableName ...
 | 
			
		||||
func (n Namespace) TableName() string {
 | 
			
		||||
	return "namespace"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// NamespaceStatusWaitActive 待激活
 | 
			
		||||
	NamespaceStatusWaitActive = 0
 | 
			
		||||
	// NamespaceStatusNormal 正常
 | 
			
		||||
	NamespaceStatusNormal = 1
 | 
			
		||||
	// NamespaceStatusForbidden 禁用
 | 
			
		||||
	NamespaceStatusForbidden = 1
 | 
			
		||||
)
 | 
			
		||||
		Reference in New Issue
	
	Block a user