Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostM ¶
type PostM struct { ID int64 `gorm:"column:id;primary_key"` Username string `gorm:"column:username;not null"` PostID string `gorm:"column:postID;not null"` Title string `gorm:"column:title;not null"` Content string `gorm:"column:content"` CreatedAt time.Time `gorm:"column:createdAt"` UpdatedAt time.Time `gorm:"column:updatedAt"` }
PostM 是数据库中 post 记录 struct 格式的映射.
type UserM ¶
type UserM struct { CreatedAt time.Time `gorm:"column:createdAt"` // Email string `gorm:"column:email"` // ID int64 `gorm:"column:id;primary_key"` // Nickname string `gorm:"column:nickname"` // Password string `gorm:"column:password"` // Phone string `gorm:"column:phone"` // UpdatedAt time.Time `gorm:"column:updatedAt"` // Username string `gorm:"column:username"` // }
func (*UserM) BeforeCreate ¶
BeforeCreate 在创建数据库记录之前加密明文密码.
Click to show internal directories.
Click to hide internal directories.