Re:Back to basics: Writing an application using Go and Postg...
by armchairhacker on Monday November 22, 2021 @09:56PM
(#29314127)
The difference is you’re still writing SQL keywords, just as functions
e.g. userPosts = Posts.InnerJoin(Users).SelectAll().Where(user => user.id == userID)
It’s not always exactly the same, but the point remains that you have to understand SQL anyways and the code usually isn’t any clearer.
Maybe i’m confusing this with query builders. ORMs also let you form queries by interacting with objects directly, e.g. ‘user = Users.Find(userID); userPosts = user.Posts’. But that leads to the other issue with inefficient and unpredictable queries.
e.g. userPosts = Posts.InnerJoin(Users).SelectAll().Where(user => user.id == userID)
It’s not always exactly the same, but the point remains that you have to understand SQL anyways and the code usually isn’t any clearer.
Maybe i’m confusing this with query builders. ORMs also let you form queries by interacting with objects directly, e.g. ‘user = Users.Find(userID); userPosts = user.Posts’. But that leads to the other issue with inefficient and unpredictable queries.