4 ms·
I’d recommend you to have a look at Objection.js: https://github.com/Vincit/objection.js/ https://github.com/Vincit/objection.js/ Objection.js is an ORM for No
by loliboli 8y ago
I’d recommend you to have a look at Objection.js: https://github.com/Vincit/objection.js/ https://github.com/Vincit/objection.js/
Objection.js is an ORM for Node.js that aims to stay out of your way and make it as easy as possible to use the full power of SQL and the underlying database engine while keeping magic to a minimum.
^^ copy+pasted from github
- eropple 8y agoThis looks interesting. Some quick thoughts: - I was worried at first because I progressively trust non-TypeScript projects less and less, but the test suite looks fine and they have official typings so there's that mitigation at least. - I really don't love the use of static properties everywhere in order to define model schema. Which is probably a little hypocritical, because one of my own projects[0] does the same thing, but IMO decorators are a cleaner way to do it that reads better to a human. - Require loop detection in model relations is cool. I like that. - In general it's a little too string-y for my tastes. I think `eager()` should take a model class, for example, rather than a string name. Maybe behind the scenes it uses the model class and pulls the string name out of it? But I think using objects-as-objects is a better way to do things than using strings-as-references. Overall, though, it seems very low-magic and I did understand most of it from a five minute peek, so I kind of like this. I think it's a little too JavaScript-y (rather than TypeScript-y) for my tastes, but maybe that can be addressed by layering on a bit of an adapter...I'll need to look deeper. [0] - https://github.com/eropple/taskbotjs https://github.com/eropple/taskbotjs