4 ms·
still yet to find an ActiveRecord equivalent for javascript.
by capnorange 6y ago
still yet to find an ActiveRecord equivalent for javascript.
- racedude 6y agoWhat about this? https://github.com/typeorm/typeorm/blob/master/docs/active-record-data-mapper.md#what-is-the-active-record-pattern https://github.com/typeorm/typeorm/blob/master/docs/active-r... (Forgive me if this isn't what you are looking for, not super familiar with ActiveRecord myself, just recalled seeing that yesterday!
- jdauriemma 6y agoYes, TypeORM is definitely the JavaScript answer to ActiveRecord
- agustif 6y agoCan vouch for TypeORM, hopefully it's creator will pick it back up soon and get it to a stable v1.0.0!!
- benatkin 6y agoI like TypeORM but have passed on it for now because of this potential sql injection issue: https://github.com/typeorm/typeorm/issues/3740 https://github.com/typeorm/typeorm/issues/3740 I have passed a field to order_by() from the user in Django before. I would be more likely to use a dict now, but I shudder at the thought of accidentally creating an SQL injection bug because I expected to be protected by my ORM.
- Thomaschaaf 6y agohttps://mikro-orm.io/ https://mikro-orm.io/ is a much better typeorm alternative as it is actively being maintained. TypeORMs development has come to a halt. And many issues are not being fixed.
- midrus 6y agoThat's Prisma [1] for me. Coming from Django, I've found prisma even better than the Django ORM, despite not yet as complete. [1] https://www.prisma.io/docs/understand-prisma/why-prisma https://www.prisma.io/docs/understand-prisma/why-prisma
- anaxag0ras 6y agoThis. I haven't tried anything complex but so far Prisma 2 has just been amazing. The API is just so clean and simple.
- cargoshipit 6y agoThis bills itself as 'ActiveRecord for Javascript'. Kinda relies on Graphiti's implementation of the JSON API spec. I really like Graphiti and Spraypaint though.
- cargoshipit 6y agoSorry got ahead of myself there: https://www.graphiti.dev/js/ https://www.graphiti.dev/js/
- stephen 6y agoI'm trying to build that: https://github.com/stephenh/joist-ts/ https://github.com/stephenh/joist-ts/ Disclaimer docs aren't amazing yet, so looking through the examples/integration tests are the best way to see how it works. Prisma has a few mentions in this thread; joist's differentiator is that it leans more "domain model" i.e. validation rules, derived values, and business-logic-y things being in the model. Which is not for everyone (i.e. the ORM-less approach of the OP/kiss-orm is fine too), but if you're looking for that sort of thing... Joist also has a novel approach for modeling the lazy-initialized collections/references of ORMs, which is historically tricky in Node/JS/TS. In Joist, all collections/references require `await` to access by default, but that gets tedious very quickly, so you can use populate hints to get a now-synchronously-accessible sub-view of the object graph.