register user db handler

This commit is contained in:
junleea 2024-07-02 20:11:25 +08:00
parent 8db7a7fa18
commit 22442eb828
1 changed files with 4 additions and 1 deletions

View File

@ -19,7 +19,10 @@ type User struct {
func CreateUser(name, password, email, gender string, age int) uint {
user := User{Name: name, Email: email, Password: password, Gender: gender, Age: age}
DB.Create(&user)
res := DB.Debug().Create(&user)
if res.Error != nil {
return 0
}
return user.ID
}