4 ms·
I've come to the same conclusion from using a number of query and relation mapping frameworks (e.g. Rails, Spring). I've finally decided to write one that solve
by karmakaze 8y ago
I've come to the same conclusion from using a number of query and relation mapping frameworks (e.g. Rails, Spring). I've finally decided to write one that solves the problems that I have with them. It comes down to just a few things:
1. Embrace SQL
2. Handle the ON clauses for JOINs
3. Fetch relations of sets of records (eager or lazy at the call site)
in batches without making N+1 queries
4. (bonus) async composability
I decided to make it in Java so it works with any language in the ecosystem and having a simple type system will make it easy to port to any others. Don't mind all the various typed expressions, you can just pass in an SQL string with locally resolved bindings then use that element in larger queries then finally execute the resulting tree that maps to the result type. I just started last week and I'd love any feedback like if you think it's a good idea or any specifics. I'm using JDBI underneath which is a good level of abstraction to complement it.
Edit (you might want the link):
https://github.com/karmakaze/safeql https://github.com/karmakaze/safeql
- rhlsthrm 8y agoThis is great, this is exactly something I've been looking for. I'll definitely look into using this for my next project.
- karmakaze 8y agoThanks for the validation. I was beginning to wonder why this hasn't been done already and maybe I'm the exception rather than part of a group who need/want it.
- ksec 8y agoHave you consider posting this as Show HN?
- karmakaze 8y agoYes that's my intention soon. I'm still dogfooding for a while to shake out its design warts. This post was so fitting I had to mention it.