3 ms·
SQLc isn't just raw SQL. SQLc you write the queries, it generates the boilerplate functions to execute them. This works better than an ORM because you don't h
by dhfuuvyvtt 2y ago
SQLc isn't just raw SQL.
SQLc you write the queries, it generates the boilerplate functions to execute them.
This works better than an ORM because you don't have to deal with an ORM.
- bvrmn 2y agoHow SQLc would solve following issue. For example I have original query: SELECT * from users where following_count > $1 and followers_count < $2; Then some refactoring later it becomes: SELECT * from users where enabled and followers_count < $1 and following_count > $2; As I understand go API would not change it still query(int, int).
- jbverschoor 2y agoUse hql named queries with named parameters
- bvrmn 2y agoWhat's hql? If it's something related to hybernate than your comment is slightly out of context.
- jbverschoor 2y agoHibernate Query Language. How is it out of context? Use Named Native Query and you have SQL queries. I really don’t understand the objection to ORMs. By that logic, you might as well reserve a block of memory and offsets instead of class/struct attributes.
- bvrmn 2y agoI did not object against ORMs. Please reread thread. I also have issues with SQLc, and please note it's Go library. Java is out of context.
- dhfuuvyvtt 2y agoI'm not sure that's an issue? It would be an odd refactor to add a new side effect to the query you didn't want to apply across the board. More likely you would introduce a new query that would get a new function call. usersWithCountBetween(a, b) vs enabledUsersWithCountBetween(a,b) If you mean, how to handle the addition of a new enabled flag that is passed in, that too would either require refactoring or a new function. These aren't really things I would consider a problem but maybe I'm missing something? Oh and you can configure the number of params before it replaces the params with an interface so things like this are easier to manage over time.
- mrastro 2y agoIs the question about how to version the query? You have comments before the query that allow you to name the exported function so you could have both queries and name them something different.