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"` UserID string `gorm:"column:user_id;not null"` Title string `gorm:"column:title;not null"` Content string `gorm:"column:content"` CreatedAt time.Time `gorm:"column:created_at"` UpdatedAt time.Time `gorm:"column:updated_at"` }
PostM 是数据库中 post 记录 struct 格式的映射.
func (*PostM) AfterCreate ¶
AfterCreate 在创建数据库记录之后生成 postID.
type UserM ¶
type UserM struct { ID int64 `gorm:"column:id;primary_key"` UserID string `gorm:"column:user_id;not null"` Username string `gorm:"column:username;not null"` Password string `gorm:"column:password;not null"` Nickname string `gorm:"column:nickname"` Email string `gorm:"column:email"` Phone string `gorm:"column:phone"` CreatedAt time.Time `gorm:"column:created_at"` UpdatedAt time.Time `gorm:"column:updated_at"` }
UserM 是数据库中 user 记录 struct 格式的映射.
func (*UserM) AfterCreate ¶
AfterCreate 在创建数据库记录之后生成 userID.
func (*UserM) BeforeCreate ¶
BeforeCreate 在创建数据库记录之前加密明文密码.
Click to show internal directories.
Click to hide internal directories.