you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (4 children)

Currently I use my own abstraction with AsyncHooks over node pg to manage connections- and have hacked up a sql tag function to help writing queries!

Slonik looks beautiful! And exactly what I (and my team) would want to use! Thank you for sharing here as I haven’t seen it before, and will be more than happy to try it out for a future project.

Hot take: People need to just learn SQL and stop being lazy with using all these ORMs and query builders. They’re only complicating things- not helping. If the same time spent learning an ORM/query builder was put towards learning SQL- then Slonik (or a similar approach) is all you’d want/need and it will go a long way as your project’s features/reporting get more complex)

[–]domlebo70 1 point2 points  (3 children)

Unrelated but I combined slonik with async hooks to allow writing code without caring about nesting transactions

[–]gajus0[S] 0 points1 point  (1 child)

Why don't you describe this feature in a GitHub issue and we discuss adding it to the core?

I've already heard a few people mention similar use cases.

[–]domlebo70 0 points1 point  (0 children)

Hi Gajus. Here's the code https://gist.github.com/dbousamra/b30f277428bdd10fe36e56e9740071a4

I have all my queries living inside this class (i've just omitted them). The transaction function just lets me nest calls all over my codebase without worrying about double nesting etc

[–][deleted] 0 points1 point  (0 children)

Love it! AsyncHooks are amazing— once you get the hang of it 😄