model

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const TableNameSecretM = "usercenter_secret"
View Source
const TableNameUserM = "usercenter_user"

Variables

This section is empty.

Functions

This section is empty.

Types

type SecretM

type SecretM struct {
	ID          int64     `gorm:"column:id;primaryKey;autoIncrement:true;comment:主键 ID" json:"id"`                     // 主键 ID
	UserID      string    `gorm:"column:userID;not null;comment:用户 ID" json:"userID"`                                  // 用户 ID
	Name        string    `gorm:"column:name;not null;comment:密钥名称" json:"name"`                                       // 密钥名称
	SecretID    string    `gorm:"column:secretID;not null;comment:密钥 ID" json:"secretID"`                              // 密钥 ID
	SecretKey   string    `gorm:"column:secretKey;not null;comment:密钥 Key" json:"secretKey"`                           // 密钥 Key
	Status      int32     `gorm:"column:status;not null;default:1;comment:密钥状态,0-禁用;1-启用" json:"status"`               // 密钥状态,0-禁用;1-启用
	Expires     int64     `gorm:"column:expires;not null;comment:0 永不过期" json:"expires"`                               // 0 永不过期
	Description string    `gorm:"column:description;not null;comment:密钥描述" json:"description"`                         // 密钥描述
	CreatedAt   time.Time `gorm:"column:createdAt;not null;default:current_timestamp;comment:创建时间" json:"createdAt"`   // 创建时间
	UpdatedAt   time.Time `gorm:"column:updatedAt;not null;default:current_timestamp;comment:最后修改时间" json:"updatedAt"` // 最后修改时间
}

SecretM mapped from table <usercenter_secret>

func (*SecretM) BeforeCreate

func (m *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;primaryKey;autoIncrement:true;comment:主键 ID" json:"id"`                                         // 主键 ID
	UserID    string    `gorm:"column:userID;not null;comment:用户 ID" json:"userID"`                                                      // 用户 ID
	Username  string    `gorm:"column:username;not null;comment:用户名称" json:"username"`                                                   // 用户名称
	Status    string    `gorm:"column:status;not null;comment:用户状态:registered,active,disabled,blacklisted,locked,deleted" json:"status"` // 用户状态:registered,active,disabled,blacklisted,locked,deleted
	Nickname  string    `gorm:"column:nickname;not null;comment:用户昵称" json:"nickname"`                                                   // 用户昵称
	Password  string    `gorm:"column:password;not null;comment:用户加密后的密码" json:"password"`                                               // 用户加密后的密码
	Email     string    `gorm:"column:email;not null;comment:用户电子邮箱" json:"email"`                                                       // 用户电子邮箱
	Phone     string    `gorm:"column:phone;not null;comment:用户手机号" json:"phone"`                                                        // 用户手机号
	CreatedAt time.Time `gorm:"column:createdAt;not null;default:current_timestamp;comment:创建时间" json:"createdAt"`                       // 创建时间
	UpdatedAt time.Time `gorm:"column:updatedAt;not null;default:current_timestamp;comment:最后修改时间" json:"updatedAt"`                     // 最后修改时间
}

UserM mapped from table <usercenter_user>

func (*UserM) AfterCreate

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

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

func (*UserM) BeforeCreate

func (m *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