AF wrote:
Hello,
Can validators be defined at table / mapper level? (Is it even a
good idea?)
I ask, since it's at the table definition layer that I define what
datatypes my columns have, so it seems natural to place the policing
function there as well.
a table level validator would
If you have mapper definitions separate from classes, theres nothing
stopping you from adding attributes to the class over there, i.e.
mapper(MyClass, mytable)
MyClass.foo = some_validation_decorator(MyClass.foo)
Personally I wouldn't bother (then again I use declarative for everything