package msg_code

import "time"

// MsgCode 验证码列表
type MsgCode struct {
	MsgCodeID       int64     `gorm:"primaryKey;column:msg_code_id;type:bigint(20);not null" json:"-"`                // 短信验证码id
	OpenID          string    `gorm:"index:open_id;column:open_id;type:varchar(32);not null" json:"openId"`           // 用户id
	Mobile          string    `gorm:"index:mobile;column:mobile;type:varchar(50);not null" json:"mobile"`             // 手机号/邮箱
	Code            string    `gorm:"column:code;type:varchar(20);not null" json:"code"`                              // 验证码
	ExpiredIn       int64     `gorm:"column:expired_in;type:bigint(20);not null" json:"expiredIn"`                    // 过期时间
	Enabled         int8      `gorm:"column:enabled;type:tinyint(1)" json:"enabled"`                                  // 状态
	CreatedTime     time.Time `gorm:"column:created_time;type:datetime;default:CURRENT_TIMESTAMP" json:"createdTime"` // 创建时间
	LastUpdatedTime time.Time `gorm:"column:last_updated_time;type:timestamp;not null;default:CURRENT_TIMESTAMP" json:"lastUpdatedTime"`
}

// TableName get sql table name.获取数据库表名
func (m *MsgCode) TableName() string {
	return "msg_code"
}

// MsgCodeColumns get sql column name.获取数据库列名
var MsgCodeColumns = struct {
	MsgCodeID       string
	OpenID          string
	Mobile          string
	Code            string
	ExpiredIn       string
	Enabled         string
	CreatedTime     string
	LastUpdatedTime string
}{
	MsgCodeID:       "msg_code_id",
	OpenID:          "open_id",
	Mobile:          "mobile",
	Code:            "code",
	ExpiredIn:       "expired_in",
	Enabled:         "enabled",
	CreatedTime:     "created_time",
	LastUpdatedTime: "last_updated_time",
}