mirror of https://github.com/EasyDarwin/EasyDarwin
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
495 B
21 lines
495 B
6 years ago
|
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 {
|
||
|
scope.SetColumn("ID", utils.ShortID())
|
||
|
return nil
|
||
|
}
|