swagger配置 数据库初始化结构调整
This commit is contained in:
26
QMPlusServer/model/dbModel/user.go
Normal file
26
QMPlusServer/model/dbModel/user.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package dbModel
|
||||
|
||||
import (
|
||||
"github.com/jinzhu/gorm"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"main/init/mysql"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
gorm.Model `json:"-"`
|
||||
UUID uuid.UUID `json:"uuid"`
|
||||
UserName string `json:"userName"`
|
||||
PassWord string `json:"passWord"`
|
||||
NickName string `json:"nickName" gorm:"default:'galeone'"`
|
||||
HeaderImg string `json:"headerImg" gorm:"default:'galeone'"`
|
||||
//Propertie // 多余属性自行添加
|
||||
//PropertieId uint // 自动关联 Propertie 的Id 附加属性过多 建议创建一对一关系
|
||||
}
|
||||
|
||||
//type Propertie struct {
|
||||
// gorm.Model
|
||||
//}
|
||||
func (u *User) Create() (err error, user interface{}) {
|
||||
err = mysql.DEFAULTDB.Create(u).Error
|
||||
return err, user
|
||||
}
|
Reference in New Issue
Block a user