#knex

2 bookmarks tagged with #knex · RSS Feed · ← All Tags

Writing Composable SQL using Knex and Pipelines

https://lackofimagination.org/2024/11/writing-composable-sql-using-knex-and-pipelines/
We have used a query builder to programmatically build SQL queries, and by using higher-order functions (functions that take other functions as arguments) and pipelines, we have: Eliminated the need to pass the query object explicitly. Made it easier to add, remove, or rearrange query modifiers without disrupting the overall structure. Improved maintainability and simplified testing since each query modifier function is a self-contained unit that can be reused across various queries and scenarios.