mariadb

package
v0.0.0-...-57fd995 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitSql

func InitSql(db *gorm.DB) error

InitSql mariadb数据库创建时初始化数据操作

Types

type Model

type Model struct {
	ModelID
	ModelTime
	ModelDelete
}

type ModelDelete

type ModelDelete struct {
	DeletedAt gorm.DeletedAt `gorm:"index;column:deleted_at;comment:删除时间" json:"deleted_at"`
}

type ModelID

type ModelID struct {
	ID uint `gorm:"primary_key;column:id;comment:主键" json:"id"`
}

type ModelTime

type ModelTime struct {
	CreatedAt uint32 `gorm:"autoCreateTime;column:created_at;comment:创建时间" json:"created_at"`
	UpdatedAt uint32 `gorm:"autoUpdateTime;column:updated_at;comment:更新时间" json:"updated_at"`
}

type User

type User struct {
	ModelID

	Username        string `gorm:"column:username;not null;comment:用户名" json:"username"`
	Password        string `gorm:"column:password;not null;comment:密码" json:"password"`
	Email           string `gorm:"column:email;not null;comment:邮箱" json:"email"`
	Mobile          string `gorm:"column:mobile;not null;comment:手机号" json:"mobile"`
	EmailVerifiedAt uint32 `gorm:"column:email_verified_at;not null;comment:邮箱验证时间" json:"email_verified_at"`
	RememberToken   string `gorm:"column:remember_token;not null;comment:记住我token" json:"remember_token"`
	Status          uint   `gorm:"type:tinyint(1);column:status;not null;default:1;comment:状态 1:正常  2:禁用" json:"status"`

	ModelTime
	ModelDelete
}

Jump to

Keyboard shortcuts

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