Swift-Kuery-ORM
Swift-Kuery-ORM copied to clipboard
How to validate model attributes?
I may be missing this completely, but I don't see a way of validating attributes of Model
s for things like uniqueness (say, user names or e-mail addresses?) and so on. Is this functionality that is not implemented / will not be implemented, or is this going to come in the future?
I'm happy to do manual validation, but it would be neat to have this supported by the ORM.
Hey @Morpheu5, unfortunately this functionality hasn't been implemented just yet. But we could definitely be willing to add it! @kilnerm could you have a look if this is a possibility?
Thanks for the clarification, @EnriqueL8! I'll go ahead and do my own validation for now, but I'll keep watching this space. Count me in at least for a discussion :)
Similar question. It would be nice if attributes could be added in a model! (Django does that quite well, and blurs the boundary between a table and a model)
Currently my detour is to use raw SQL to set constraints after the createTableSync()
is done. E.g., ALTER TABLE "People" ADD CONSTRAINT uc_person_id UNIQUE(person_id);