Added email field to user.
This commit is contained in:
parent
dee7a13cba
commit
6ec1b77684
16 changed files with 410 additions and 139 deletions
|
|
@ -14,16 +14,20 @@ import (
|
|||
func init() {
|
||||
userFields := schema.User{}.Fields()
|
||||
_ = userFields
|
||||
// userDescUsername is the schema descriptor for username field.
|
||||
userDescUsername := userFields[0].Descriptor()
|
||||
// user.UsernameValidator is a validator for the "username" field. It is called by the builders before save.
|
||||
user.UsernameValidator = userDescUsername.Validators[0].(func(string) error)
|
||||
// userDescName is the schema descriptor for name field.
|
||||
userDescName := userFields[0].Descriptor()
|
||||
// user.NameValidator is a validator for the "name" field. It is called by the builders before save.
|
||||
user.NameValidator = userDescName.Validators[0].(func(string) error)
|
||||
// userDescEmail is the schema descriptor for email field.
|
||||
userDescEmail := userFields[1].Descriptor()
|
||||
// user.EmailValidator is a validator for the "email" field. It is called by the builders before save.
|
||||
user.EmailValidator = userDescEmail.Validators[0].(func(string) error)
|
||||
// userDescPassword is the schema descriptor for password field.
|
||||
userDescPassword := userFields[1].Descriptor()
|
||||
userDescPassword := userFields[2].Descriptor()
|
||||
// user.PasswordValidator is a validator for the "password" field. It is called by the builders before save.
|
||||
user.PasswordValidator = userDescPassword.Validators[0].(func(string) error)
|
||||
// userDescCreatedAt is the schema descriptor for created_at field.
|
||||
userDescCreatedAt := userFields[2].Descriptor()
|
||||
userDescCreatedAt := userFields[3].Descriptor()
|
||||
// user.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||
user.DefaultCreatedAt = userDescCreatedAt.Default.(func() time.Time)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue