This repository has been archived by the owner on Feb 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Update Error Message / HTTP Folder #27
Comments
I'll have a look. Is it the |
try error upload |
That branch does not exist. Please provide a reproducible example, so I can have a look. |
you can use the second branch copy. |
Please update elk to |
Receiving validation error on SetEmail 2021/09/28 13:33:42 failed adding user details to database: ent: validator failed for field "email": please enter a valid email address func User(ctx context.Context, client *ent.Client) error {
if err := client.User.CreateBulk(
client.User.Create().SetUsername("pauline").SetPassword("paul834").SetEmail("pauline@gmail.com"),
client.User.Create().SetUsername("patrick").SetPassword("patrick214").SetEmail("patick@gmail.com"),
client.User.Create().SetUsername("jason").SetPassword("jason001").SetEmail("jason@gmail.com"),
client.User.Create().SetUsername("anna").SetPassword("anna125").SetEmail("anna@gmail.com"),
client.User.Create().SetUsername("Jack").SetPassword("jackson43").SetEmail("jackson@gmail.com"),
// ...
).Exec(ctx); err != nil {
return err
} validate field.String("email").Unique().
Match(regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$")).
Validate(func(s string) error {
if s == s {
return errors.New("please enter a valid email address")
}
return nil
}), |
forgot to add; if s != s |
This is not an error with elk. Please refrain from using the GitHub Issues for questions regarding Ent. That is what the Slack and Discord channels are for. You mean this Validator? Validate(func(s string) error {
if s != s {
return errors.New("please enter a valid email address")
}
return nil
}) That will always return nil. For literally every string there is. If swapped to |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Think there might be another issue or something, as I've added Positive(), method to a field and is showing an error in http/update.go file. Removed it and it goes away. Issue also with Username which I do have but saying its undefined in the update file. I've pushed the repository to github so you can do a pull request on it and let us know.
The text was updated successfully, but these errors were encountered: