I made this code, thinking about how to start a query builder or something, this code is an implementation of a pagination, it works, but to insert WHERE, ORDER or any other statement this code would be extremely complex.
Then I worked on a research to understand how Knex and other ORMs do that magic. I saw just the tip of the iceberg, but I think I understand how is the logic. The implementation is hard because of the amount of details.
Anyway I think we can do something simple, to cover pagination, order and these statements that don't involve logic like Where and Join, in this moment. But preparing to implement these in a second moment.
I made this code, thinking about how to start a query builder or something, this code is an implementation of a pagination, it works, but to insert WHERE, ORDER or any other statement this code would be extremely complex.
Then I worked on a research to understand how Knex and other ORMs do that magic. I saw just the tip of the iceberg, but I think I understand how is the logic. The implementation is hard because of the amount of details.
Anyway I think we can do something simple, to cover pagination, order and these statements that don't involve logic like Where and Join, in this moment. But preparing to implement these in a second moment.