validation and ensuring global constraints are met at the database layer
are two completely seperate things.
One validates that a piece of data is valid and sanitized by some local
constraint. The other checks global constraints across your entire system.
Why would you want to split these up?
just 2 cents:
guys, please don't mix up validity and conformity to business rules.
sometimes it's hard to not to mix them up, but it is important
doe distinguish. That a form field should be an email address is the first
one, that this address should be unique in the system, is the other
Your validating logic is only async if it does IO.
If your validation does IO you fucked up. You don't need async support.
On Mon, Jan 21, 2013 at 10:11 AM, Alan Hoffmeister
alanhoffmeis...@gmail.com wrote:
Katsumoto, thats a nice well known package, but I think that lacks async
support.
So how do you validate duplicated username, e-mail, etc..? As far as I
could see I need to split the validation process for this, and I think that
this is fucking up with the validation.
--
Att,
Alan Hoffmeister
2013/1/22 Jake Verbaten rayn...@gmail.com
Your validating logic is only async if
Duplicate validation should be handled at the persistence layer, not in Node,
since you have a concurrency issue there (think of 2 simultaneous requests).
--
Pedro
On Tuesday, January 22, 2013 at 11:06 AM, Alan Hoffmeister wrote:
So how do you validate duplicated username, e-mail, etc..?
Well, generaly I don't wait for the db to throw a duplication error to warn
the user that he needs to pick up another username. But of course, if the
form is 100% valid I still need to take care about his username at the db
layer.
Another example: I need to check if a file exists, send a request
comments inline.
On 01/22/2013 01:56 PM, Alan Hoffmeister wrote:
Well, generaly I don't wait for the db to throw a duplication error to
warn the user that he needs to pick up another username. But of course,
if the form is 100% valid I still need to take care about his username
at the db
It is not about performance, it is about forcefully trying to merge two
completely different things. I might be wrong, but I can't think of a
pretty and useful API for a validation library that would transparently
issue async operations, and then let you get those results if validation
passed.
take a look at https://github.com/chriso/node-validator
пятница, 18 января 2013 г., 13:07:13 UTC+2 пользователь Alan Hoffmeister
написал:
Hello fellows!
How are you doing data validation like forms and other user inputs? I know
that there is some modules to do that but my intention is to
Katsumoto, thats a nice well known package, but I think that lacks async
support.
--
Att,
Alan Hoffmeister
2013/1/21 Katsumoto shogun...@gmail.com
take a look at https://github.com/chriso/node-validator
пятница, 18 января 2013 г., 13:07:13 UTC+2 пользователь Alan Hoffmeister
написал:
10 matches
Mail list logo