models

package
v0.0.0-...-b97b37b Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 是否删除
	IsDeletedNo  = 0 // 否
	IsDeletedYes = 1 // 是

	// 是否分库分表
	IsShardNo  = 0 // 否
	IsShardYes = 1 // 是

	StorageTypeSingle = "single"
	StorageTypeShard  = "shard"
	StorageTypeTIDB   = "tidb"

	Underscore = "_"
)
View Source
const (
	// 实例角色
	InstanceRoleUnknow = ""
	InstanceRoleMaster = "master"
	InstanceRoleSlave  = "slave"
	InstanceRoleBackup = "backup"

	// 是否维护
	InstanceIsMaintenanceNo  = 0 // 否
	InstanceIsMaintenanceYes = 1 // 是
)
View Source
const (
	// 集群类别
	ClusterCategoryUnknow          = 0 // 未知
	ClusterCategoryTceSelfMySQL    = 1 // TCE自建MySQL
	ClusterCategoryPublicSelfMySQL = 2 // 公有云自建MySQL
	ClusterCategoryTceTDSQL        = 3 // TEC-TDSQL
	ClusterCategoryPublicTDSQLC    = 4 // 公有云TDSQL-C
	ClusterCategoryPublicMySQL     = 5 // 公有云MySQL
	ClusterCategoryFuZhouMySQL     = 6 // 福州MySQL(自建)
	ClusterCategoryTIDB            = 7 // tidb

	// 分库分表类型
	ShardTypeNone               = ""
	ShardTypeMycat              = "mycat"
	ShardTypeTDSQL              = "tdsql"
	ShardTypeZebra              = "zebra"
	ShardTypeShardingJdbc       = "sharding-jdbc"
	ShardTypeShardingJdbcOnlyDB = "sharding-jdbc-only-db"

	// 分库分表后缀递增类型
	ShardIncrementTypeNone   = ""
	ShardIncrementTypeGlobal = "global" // 全局递增
	ShardIncrementTypeOneDB  = "one-db" // 一个数据库中递增
)
View Source
const (
	MysqlDBPrivApplyOrderStatusUnknow = iota
	MysqlDBPrivApplyOrderStatusApplying
	MysqlDBPrivApplyOrderStatusSuccess
	MysqlDBPrivApplyOrderStatusFail
)
View Source
const (
	RoleDBA   = "dba"
	RoleDev   = "dev"
	RoleGuest = "guest"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	ID            types.NullInt64  `json:"id" gorm:"column:id"`
	InstanceId    types.NullString `json:"instance_id" gorm:"column:instance_id;unique;not null;default:'';size:50"`
	InstanceName  types.NullString `json:"instance_name" gorm:"column:instance_name;not null;default:'';size:100"`
	MetaClusterId types.NullInt64  `json:"meta_cluster_id" gorm:"column:meta_cluster_id;not null;default:0"`
	MachineHost   types.NullString `json:"machine_host" gorm:"column:machine_host;not null;default:'';size:15"`
	VpcgwRip      types.NullString `json:"vpcgw_rip" gorm:"column:vpcgw_rip;not null;default:'';size:15"`
	Port          types.NullInt64  `json:"port" gorm:"column:port;not null;default:0"`
	MasterHost    types.NullString `json:"master_host" gorm:"column:master_host;not null;default:'';size:15"`
	MasterPort    types.NullInt64  `json:"master_port" gorm:"column:master_port;not null;default:0"`
	VipPort       types.NullString `json:"vip_port" gorm:"column:vip_port;not null;default:'';size:30"`
	VpcgwVipPort  types.NullString `json:"vpcgw_vip_port" gorm:"column:vpcgw_vip_port;not null;default:'';size:30"`
	Role          types.NullString `json:"role" gorm:"column:role;not null;default:'';size:15"`
	Cpu           types.NullInt64  `json:"cpu" gorm:"column:cpu;not null;default:0"`
	Mem           types.NullInt64  `json:"mem" gorm:"column:mem;not null;default:0"`
	Disk          types.NullInt64  `json:"disk" gorm:"column:disk;not null;default:0"`
	Version       types.NullString `json:"version" gorm:"column:version;not null;default:'';size:15"`
	IsMaintenance types.NullInt64  `json:"is_maintenance" gorm:"column:is_maintenance;not null;default:0"`
	IsDeleted     types.NullInt64  `json:"is_deleted" gorm:"column:is_deleted;not null;default:0"`
	Descript      types.NullString `json:"descript" gorm:"column:descript"`
	UpdatedAt     types.NullTime   `json:"updated_at" gorm:"column:updated_at"`
	CreatedAt     types.NullTime   `json:"created_at" gorm:"column:created_at"`
}

func (Instance) TableName

func (Instance) TableName() string

func (Instance) TableNameAndAlias

func (Instance) TableNameAndAlias(alias string) string

type MetaCluster

type MetaCluster struct {
	ID           types.NullInt64  `json:"id" gorm:"column:id"`
	Name         types.NullString `json:"name" gorm:"column:name;unique;not null;size:50"`
	ClusterId    types.NullString `json:"cluster_id" gorm:"column:cluster_id;unique;not null;default:'';size:50"`
	BusinessLine types.NullString `json:"business_line" gorm:"column:business_line;unique;not null;default:'';size:100"`
	Owner        types.NullString `json:"owner" gorm:"column:owner;unique;not null;default:'';size:50"`
	IsDeleted    types.NullInt64  `json:"is_deleted" gorm:"column:is_deleted;not null;default:0"`
	DomainName   types.NullString `json:"domain_name" gorm:"column:domain_name;not null;default:'';size:500"`
	VipPort      types.NullString `json:"vip_port" gorm:"column:vip_port;not null;default:'';size:30"`
	VpcgwVipPort types.NullString `json:"vpcgw_vip_port" gorm:"column:vpcgw_vip_port;not null;default:'';size:30"`
	ReadHostPort types.NullString `json:"read_host_port" gorm:"column:read_host_port;not null;default:'';size:30"`
	IsShard      types.NullInt64  `json:"is_shard" gorm:"column:is_shard;not null;default:0"`
	ShardType    types.NullString `json:"shard_type" gorm:"column:shard_type;not null;default:'';size:20"`
	Category     types.NullInt64  `json:"category" gorm:"column:category;not null;default:0"`
	SetName      types.NullString `json:"set_name" gorm:"column:set_name;not null;default:'';size:30"`
	UpdatedAt    types.NullTime   `json:"updated_at" gorm:"column:updated_at"`
	CreatedAt    types.NullTime   `json:"created_at" gorm:"column:created_at"`
}

func (MetaCluster) TableName

func (MetaCluster) TableName() string

type MysqlDBPriv

type MysqlDBPriv struct {
	ID            types.NullInt64  `json:"id" gorm:"column:id"`
	OrderUUID     types.NullString `json:"order_uuid" gorm:"column:order_uuid"`
	UserId        types.NullInt64  `json:"user_id" gorm:"column:user_id"`
	Username      types.NullString `json:"username" gorm:"column:username;unique;not null;size:50"`
	NameZh        types.NullString `json:"name_zh" gorm:"column:name_zh"`
	MetaClusterId types.NullInt64  `json:"meta_cluster_id" gorm:"column:meta_cluster_id"`
	ClusterName   types.NullString `json:"cluster_name" gorm:"column:cluster_name"`
	DBName        types.NullString `json:"db_name" gorm:"column:db_name"`
	VipPort       types.NullString `json:"vip_port" gorm:"column:vip_port"`
	UpdatedAt     types.NullTime   `json:"updated_at" gorm:"column:updated_at"`
	CreatedAt     types.NullTime   `json:"created_at" gorm:"column:created_at"`
}

func PrivApplyToPriv

func PrivApplyToPriv(apply *MysqlDBPrivApply) *MysqlDBPriv

func PrivApplysToPrivs

func PrivApplysToPrivs(applys []*MysqlDBPrivApply) []*MysqlDBPriv

func (MysqlDBPriv) TableName

func (MysqlDBPriv) TableName() string

type MysqlDBPrivApply

type MysqlDBPrivApply struct {
	ID            types.NullInt64  `json:"id" gorm:"column:id"`
	OrderUUID     types.NullString `json:"order_uuid" gorm:"column:order_uuid"`
	UserId        types.NullInt64  `json:"user_id" gorm:"column:user_id"`
	Username      types.NullString `json:"username" gorm:"column:username;unique;not null;size:50"`
	NameZh        types.NullString `json:"name_zh" gorm:"column:name_zh"`
	MetaClusterId types.NullInt64  `json:"meta_cluster_id" gorm:"column:meta_cluster_id"`
	ClusterName   types.NullString `json:"cluster_name" gorm:"column:cluster_name"`
	DBName        types.NullString `json:"db_name" gorm:"column:db_name"`
	VipPort       types.NullString `json:"vip_port" gorm:"column:vip_port"`
	UpdatedAt     types.NullTime   `json:"updated_at" gorm:"column:updated_at"`
	CreatedAt     types.NullTime   `json:"created_at" gorm:"column:created_at"`
}

func (MysqlDBPrivApply) TableName

func (MysqlDBPrivApply) TableName() string

type MysqlDBPrivApplyOrder

type MysqlDBPrivApplyOrder struct {
	ID           types.NullInt64  `json:"id" gorm:"column:id"`
	OrderUUID    types.NullString `json:"order_uuid" gorm:"column:order_uuid"`
	UserId       types.NullInt64  `json:"user_id" gorm:"column:user_id"`
	Username     types.NullString `json:"username" gorm:"column:username;unique;not null;size:50"`
	NameZh       types.NullString `json:"name_zh" gorm:"column:name_zh"`
	ApplyStatus  types.NullInt64  `json:"apply_status" gorm:"column:apply_status"`
	ApplyReason  types.NullString `json:"apply_reason" gorm:"column:apply_reason"`
	ErrorMessage types.NullString `json:"error_message" gorm:"column:error_message"`
	UpdatedAt    types.NullTime   `json:"updated_at" gorm:"column:updated_at"`
	CreatedAt    types.NullTime   `json:"created_at" gorm:"column:created_at"`
}

func (MysqlDBPrivApplyOrder) TableName

func (MysqlDBPrivApplyOrder) TableName() string

type MysqlDBPrivTrash

type MysqlDBPrivTrash struct {
	ID            types.NullInt64  `json:"id" gorm:"column:id"`
	MysqlDBPrivId types.NullInt64  `json:"mysql_db_priv_id" gorm:"column:mysql_db_priv_id"`
	OrderUUID     types.NullString `json:"order_uuid" gorm:"column:order_uuid"`
	UserId        types.NullInt64  `json:"user_id" gorm:"column:user_id"`
	Username      types.NullString `json:"username" gorm:"column:username;unique;not null;size:50"`
	NameZh        types.NullString `json:"name_zh" gorm:"column:name_zh"`
	MetaClusterId types.NullInt64  `json:"meta_cluster_id" gorm:"column:meta_cluster_id"`
	ClusterName   types.NullString `json:"cluster_name" gorm:"column:cluster_name"`
	DBName        types.NullString `json:"db_name" gorm:"column:db_name"`
	VipPort       types.NullString `json:"vip_port" gorm:"column:vip_port"`
	UpdatedAt     types.NullTime   `json:"updated_at" gorm:"column:updated_at"`
	CreatedAt     types.NullTime   `json:"created_at" gorm:"column:created_at"`
}

func PrivToPrivTrash

func PrivToPrivTrash(priv *MysqlDBPriv) *MysqlDBPrivTrash

func PrivsToPrivTrashs

func PrivsToPrivTrashs(privs []*MysqlDBPriv) []*MysqlDBPrivTrash

func (MysqlDBPrivTrash) TableName

func (MysqlDBPrivTrash) TableName() string

type User

type User struct {
	ID        types.NullInt64  `json:"id" gorm:"column:id"`
	Username  types.NullString `json:"username" gorm:"column:username;unique;not null;size:50"`
	Password  types.NullString `json:"password" gorm:"column:password;not null;default:'';size:128"`
	Email     types.NullString `json:"email" gorm:"column:email;not null;default:''"`
	Mobile    types.NullString `json:"mobile" gorm:"column:mobile;not null;default:''"`
	NameEn    types.NullString `json:"name_en" gorm:"column:name_en;not null;default:''"`
	NameZh    types.NullString `json:"name_zh" gorm:"column:name_zh;not null;default:''"`
	Role      types.NullString `json:"role" gorm:"column:role"`
	IsDeleted types.NullInt64  `json:"is_deleted" gorm:"column:is_deleted;not null;default:0"`
	UpdatedAt types.NullTime   `json:"updated_at" gorm:"column:updated_at"`
	CreatedAt types.NullTime   `json:"created_at" gorm:"column:created_at"`
}

func (User) TableName

func (User) TableName() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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