2018-11-07 11:28:13 +00:00
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/jinzhu/gorm"
|
|
|
|
"github.com/penggy/EasyGoLib/utils"
|
|
|
|
)
|
|
|
|
|
|
|
|
type User struct {
|
|
|
|
ID string `structs:"id" gorm:"primary_key;type:TEXT;not null" form:"id" json:"id"`
|
|
|
|
Username string `gorm:"type:TEXT"`
|
|
|
|
Password string `gorm:"type:TEXT"`
|
|
|
|
Role string `gorm:"type:TEXT"`
|
|
|
|
Reserve1 string `gorm:"type:TEXT"`
|
|
|
|
Reserve2 string `gorm:"type:TEXT"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (user *User) BeforeCreate(scope *gorm.Scope) error {
|
2020-09-18 01:39:05 +00:00
|
|
|
return scope.SetColumn("ID", utils.ShortID())
|
2018-11-07 11:28:13 +00:00
|
|
|
}
|