Comments (8)
I'll have a look. Is it the copy
branch?
from elk.
try error upload
from elk.
That branch does not exist. Please provide a reproducible example, so I can have a look.
from elk.
you can use the second branch copy.
from elk.
Please update elk to v0.4.8
.
from elk.
Receiving validation error on SetEmail
go run server.go
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("[email protected]"),
client.User.Create().SetUsername("patrick").SetPassword("patrick214").SetEmail("[email protected]"),
client.User.Create().SetUsername("jason").SetPassword("jason001").SetEmail("[email protected]"),
client.User.Create().SetUsername("anna").SetPassword("anna125").SetEmail("[email protected]"),
client.User.Create().SetUsername("Jack").SetPassword("jackson43").SetEmail("[email protected]"),
// ...
).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
}),
from elk.
forgot to add; if s != s
from elk.
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 if s == s
it will always fail. https://play.golang.org/p/Mlme54tfutN
from elk.
Related Issues (20)
- Does not generate when using other types for IDs HOT 7
- Provide elk command HOT 7
- no OAS-type exists for field.JSON fields HOT 8
- Consider generating a client? HOT 9
- Remove arbitrary numbers in OpenApi JSON objects HOT 12
- Chi will not compile HOT 1
- Generate http handler with errors "invalid import path" HOT 6
- Curl add user HOT 20
- Missing zap import? HOT 3
- Question: How to change JSON-output specification HOT 3
- Go module indirect dependency HOT 3
- missing required field "name" HOT 1
- question if elk solves this ent deficit HOT 1
- How do you deal with sanitization? HOT 3
- Open api async ? HOT 2
- no OAS-type exists for "[]byte" HOT 3
- easyjson complains when generating code to a different package.
- Problem testing the ent-elk crud example HOT 2
- Support other framework (e.g. gin/echo). HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elk.