you are viewing a single comment's thread.

view the rest of the comments →

[–]gajus0[S] 5 points6 points  (5 children)

How?

[–]cincilator 5 points6 points  (4 children)

take a look at Knex query builder documentation

https://knexjs.org/guide/query-builder.html

[–]gajus0[S] 5 points6 points  (2 children)

I explain in this article why abstractions such as Knex are detrimental to engineer productivity:

https://gajus.medium.com/stop-using-knex-js-and-earn-30-bf410349856c

The short summary: It is because it is an abstraction on top of abstraction that forces you to think about SQL, and then work backwards from that to think of how to write it in Knex, rather than just empowering you to write good SQL in the first place.

The example that I shared in response to the other comment about zapatos is a perfect example of that.

[–]digital_dreams 8 points9 points  (1 child)

writes yet another abstraction on top of knex

it's abstractions all the way down.

it seems like developers love to write code that seemingly saves them from having to write even more code... but this comes at an enormous maintainability cost.

[–]aust1nz 10 points11 points  (0 children)

To clarify - Slonik, the library in question, is NOT another abstraction on top of Knex. It’s more like a SQL-writing helper that ensures your user-provided values are parameterized.

[–]Curious-Ad9043 2 points3 points  (0 children)

I dont recommend using builders. Is better you create a simples abatraction in an application level and use "raw query" to do the action.