model

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StatusPending 未发送
	StatusPending = 0
	// StatusSent 发送成功
	StatusSent = 1
	// StatusFailed 发送失败
	StatusFailed = 2
)

Variables

View Source
var DB *gorm.DB

DB 数据库链接单例

Functions

func AutoMigrate

func AutoMigrate()

AutoMigrate 自动迁移

func InitDatabase

func InitDatabase()

InitDatabase 在中间件中初始化mysql链接

Types

type Mail

type Mail struct {
	gorm.Model
	UserID     uint   `gorm:"type:int unsigned;not null;"`               // 用户ID
	Status     uint   `gorm:"type:tinyint unsigned;not null;default 0;"` // 状态,0未发送,1已发送,2发送失败
	SenderName string `gorm:"type:varchar(255);not null;"`               // 发送者名称
	Type       string `gorm:"type:varchar(50);not null;"`                // 类型,支持:text, html
	Subject    string `gorm:"type:varchar(255);not null;"`               // 主题
	Content    string `gorm:"type:text;not null;"`                       // 内容
	ToMailList string `gorm:"type:text(255);not null;"`                  // 收件人列表
}

Mail Mail

type Token

type Token struct {
	gorm.Model
	UserID    uint   `gorm:"type:int unsigned;not null;"` // 用户ID
	TokenName string `gorm:"type:varchar(255);not null;"` // Token名称
	Token     string `gorm:"type:varchar(255);not null;"` // Token值
}

Token token

type User

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(50); not null;unique;"` // 用户名
	Nickname string `gorm:"type:varchar(255);not null;"`        // 昵称
	Avatar   string `gorm:"type:varchar(255);not null;"`        // 头像URL地址或图片Base64编码
	Enabled  bool   `gorm:"type:tinyint;not null;default: 0;"`  // 是否启用
	Digest   string `gorm:"type:varchar(255);not null;"`        // 数字摘要
}

User user model

Jump to

Keyboard shortcuts

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