model

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusUserDisabled = iota // Status used for disabling a user.
	StatusUserNormal          // Status used for enabling a user.
)

User status constants.

View Source
const (
	StatusSecretDisabled = iota // Status used for disabling a secret.
	StatusSecretNormal          // Status used for enabling a secret.
)

Secret status constants.

View Source
const TableNameChainM = "api_chain"
View Source
const TableNameMinerM = "api_miner"
View Source
const TableNameMinerSetM = "api_minerset"
View Source
const TableNameSecretM = "uc_secret"
View Source
const TableNameUserM = "uc_user"

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainM

type ChainM struct {
	ID        int64  `gorm:"column:id;type:bigint(20) unsigned;primaryKey;autoIncrement:true;comment:主键 ID" json:"id"` // 主键 ID
	Namespace string ``                                                                                                // 命名空间
	/* 131-byte string literal not displayed */
	Name                   string    `gorm:"column:name;type:varchar(253);not null;uniqueIndex:uniq_namespace_name,priority:2;comment:区块链名" json:"name"` // 区块链名
	DisplayName            string    `gorm:"column:display_name;type:varchar(253);not null;comment:区块链展示名" json:"display_name"`                          // 区块链展示名
	MinerType              string    `gorm:"column:miner_type;type:varchar(16);not null;comment:区块链矿机机型" json:"miner_type"`                              // 区块链矿机机型
	Image                  string    `gorm:"column:image;type:varchar(253);not null;comment:区块链镜像 ID" json:"image"`                                      // 区块链镜像 ID
	MinMineIntervalSeconds int32     `gorm:"column:min_mine_interval_seconds;type:int(8);not null;comment:矿机挖矿间隔" json:"min_mine_interval_seconds"`      // 矿机挖矿间隔
	CreatedAt              time.Time `gorm:"column:created_at;type:datetime;not null;default:current_timestamp();comment:创建时间" json:"created_at"`        // 创建时间
	UpdatedAt              time.Time `gorm:"column:updated_at;type:datetime;not null;default:current_timestamp();comment:最后修改时间" json:"updated_at"`      // 最后修改时间
}

ChainM mapped from table <api_chain>

func (*ChainM) TableName

func (*ChainM) TableName() string

TableName ChainM's table name

type MinerM

type MinerM struct {
	ID        int64  `gorm:"column:id;type:bigint(20) unsigned;primaryKey;autoIncrement:true;comment:主键 ID" json:"id"` // 主键 ID
	Namespace string ``                                                                                                // 命名空间
	/* 131-byte string literal not displayed */
	Name        string `gorm:"column:name;type:varchar(253);not null;uniqueIndex:uniq_namespace_name,priority:2;comment:矿机名" json:"name"` // 矿机名
	DisplayName string `gorm:"column:display_name;type:varchar(253);not null;comment:矿机展示名" json:"display_name"`                          // 矿机展示名
	Phase       string `gorm:"column:phase;type:varchar(45);not null;comment:矿机状态" json:"phase"`                                          // 矿机状态
	MinerType   string `gorm:"column:miner_type;type:varchar(16);not null;comment:矿机机型" json:"miner_type"`                                // 矿机机型
	ChainName   string ``                                                                                                                 // 矿机所属的区块链名
	/* 137-byte string literal not displayed */
	CPU       int32     `gorm:"column:cpu;type:int(8);not null;comment:矿机 CPU 规格" json:"cpu"`                                          // 矿机 CPU 规格
	Memory    int32     `gorm:"column:memory;type:int(8);not null;comment:矿机内存规格" json:"memory"`                                       // 矿机内存规格
	CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null;default:current_timestamp();comment:创建时间" json:"created_at"`   // 创建时间
	UpdatedAt time.Time `gorm:"column:updated_at;type:datetime;not null;default:current_timestamp();comment:最后修改时间" json:"updated_at"` // 最后修改时间
}

MinerM mapped from table <api_miner>

func (*MinerM) TableName

func (*MinerM) TableName() string

TableName MinerM's table name

type MinerSetM

type MinerSetM struct {
	ID        int64  `gorm:"column:id;type:bigint(20) unsigned;primaryKey;autoIncrement:true;comment:主键 ID" json:"id"` // 主键 ID
	Namespace string ``                                                                                                // 命名空间
	/* 131-byte string literal not displayed */
	Name                 string `gorm:"column:name;type:varchar(253);not null;uniqueIndex:uniq_namespace_name,priority:2;comment:矿机池名" json:"name"` // 矿机池名
	Replicas             int32  `gorm:"column:replicas;type:int(8);not null;comment:矿机副本数" json:"replicas"`                                         // 矿机副本数
	DisplayName          string `gorm:"column:display_name;type:varchar(253);not null;comment:矿机池展示名" json:"display_name"`                          // 矿机池展示名
	DeletePolicy         string `gorm:"column:delete_policy;type:varchar(32);not null;comment:矿机池缩容策略" json:"delete_policy"`                        // 矿机池缩容策略
	MinReadySeconds      int32  `gorm:"column:min_ready_seconds;type:int(8);not null;comment:矿机 Ready 最小等待时间" json:"min_ready_seconds"`             // 矿机 Ready 最小等待时间
	FullyLabeledReplicas int32  ``                                                                                                                  // 所有标签匹配的副本数
	/* 126-byte string literal not displayed */
	ReadyReplicas     int32     `gorm:"column:ready_replicas;type:int(8);not null;comment:Ready 副本数" json:"ready_replicas"`                     // Ready 副本数
	AvailableReplicas int32     `gorm:"column:available_replicas;type:int(8);not null;comment:可用副本数" json:"available_replicas"`                 // 可用副本数
	FailureReason     string    `gorm:"column:failure_reason;type:longtext;comment:失败原因" json:"failure_reason"`                                 // 失败原因
	FailureMessage    string    `gorm:"column:failure_message;type:longtext;comment:失败信息" json:"failure_message"`                               // 失败信息
	Conditions        string    `gorm:"column:conditions;type:longtext;comment:矿机池状态" json:"conditions"`                                        // 矿机池状态
	CreatedAt         time.Time `gorm:"column:created_at;type:timestamp;not null;default:current_timestamp();comment:创建时间" json:"created_at"`   // 创建时间
	UpdatedAt         time.Time `gorm:"column:updated_at;type:timestamp;not null;default:current_timestamp();comment:最后修改时间" json:"updated_at"` // 最后修改时间
}

MinerSetM mapped from table <api_minerset>

func (*MinerSetM) TableName

func (*MinerSetM) TableName() string

TableName MinerSetM's table name

type SecretM

type SecretM struct {
	ID          int64     `gorm:"column:id;type:bigint(20) unsigned;primaryKey;autoIncrement:true;comment:主键 ID" json:"id"`                        // 主键 ID
	UserID      string    `gorm:"column:user_id;type:varchar(253);not null;index:idx_user_id,priority:1;comment:用户 ID" json:"user_id"`             // 用户 ID
	Name        string    `gorm:"column:name;type:varchar(253);not null;comment:密钥名称" json:"name"`                                                 // 密钥名称
	SecretID    string    `gorm:"column:secret_id;type:varchar(36);not null;uniqueIndex:uniq_secret_id,priority:1;comment:密钥 ID" json:"secret_id"` // 密钥 ID
	SecretKey   string    `gorm:"column:secret_key;type:varchar(36);not null;comment:密钥 Key" json:"secret_key"`                                    // 密钥 Key
	Status      int32     `gorm:"column:status;type:tinyint(3) unsigned;not null;default:1;comment:密钥状态,0-禁用;1-启用" json:"status"`                  // 密钥状态,0-禁用;1-启用
	Description string    `gorm:"column:description;type:varchar(255);not null;comment:密钥描述" json:"description"`                                   // 密钥描述
	CreatedAt   time.Time `gorm:"column:created_at;type:datetime;not null;default:current_timestamp();comment:创建时间" json:"created_at"`             // 创建时间
	UpdatedAt   time.Time `gorm:"column:updated_at;type:datetime;not null;default:current_timestamp();comment:最后修改时间" json:"updated_at"`           // 最后修改时间
	Expires     int64     `gorm:"column:expires;type:bigint(64);not null" json:"expires"`
}

SecretM mapped from table <uc_secret>

func (*SecretM) BeforeCreate

func (s *SecretM) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate runs before creating a SecretM database record and initializes various fields.

func (*SecretM) TableName

func (*SecretM) TableName() string

TableName SecretM's table name

type UserM

type UserM struct {
	ID        int64     `gorm:"column:id;type:bigint(20) unsigned;primaryKey;autoIncrement:true;comment:主键 ID" json:"id"`                    // 主键 ID
	UserID    string    `gorm:"column:user_id;type:varchar(253);not null;uniqueIndex:idx_user_id,priority:1;comment:用户 ID" json:"user_id"`   // 用户 ID
	Username  string    `gorm:"column:username;type:varchar(253);not null;uniqueIndex:idx_username,priority:1;comment:用户名称" json:"username"` // 用户名称
	Status    int32     `gorm:"column:status;type:tinyint(3) unsigned;not null;default:1;comment:用户状态,0-禁用;1-启用" json:"status"`              // 用户状态,0-禁用;1-启用
	Nickname  string    `gorm:"column:nickname;type:varchar(253);not null;comment:用户昵称" json:"nickname"`                                     // 用户昵称
	Password  string    `gorm:"column:password;type:varchar(64);not null;comment:用户加密后的密码" json:"password"`                                  // 用户加密后的密码
	Email     string    `gorm:"column:email;type:varchar(253);not null;comment:用户电子邮箱" json:"email"`                                         // 用户电子邮箱
	Phone     string    `gorm:"column:phone;type:varchar(16);not null;comment:用户手机号" json:"phone"`                                           // 用户手机号
	CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null;default:current_timestamp();comment:创建时间" json:"created_at"`         // 创建时间
	UpdatedAt time.Time `gorm:"column:updated_at;type:datetime;not null;default:current_timestamp();comment:最后修改时间" json:"updated_at"`       // 最后修改时间
}

UserM mapped from table <uc_user>

func (*UserM) AfterCreate

func (u *UserM) AfterCreate(tx *gorm.DB) (err error)

AfterCreate runs after creating a UserM database record and updates the UserID field.

func (*UserM) BeforeCreate

func (u *UserM) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate runs before creating a UserM database record and initializes various fields.

func (*UserM) TableName

func (*UserM) TableName() string

TableName UserM's table name

Jump to

Keyboard shortcuts

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