Re:What ORMs have taught me: just learn SQL
by learc83 on Monday August 04, 2014 @06:30PM
(#8134434)
Is there something like YeSQL for Go?
[ Parent
| on HN ]
Re:What ORMs have taught me: just learn SQL
by elithrar on Monday August 04, 2014 @07:18PM
(#8134612)
Not that I've seen, but I've love to see it. You could probably build it with something like text/template and write:
SELECT id, title, expiry_date FROM posts WHERE id = {{ id }} AND expiry_date > {{ date }} ORDER BY expiry_date
This would give you some flexibility--the template tags would be replaced by ? or $1 or :name depending on the database driver set on parse--and leans on the stdlib. This would tie in nicely with https://github.com/jmoiron/sqlx and its struct tag/marshaling behaviour.Access could be handled by a map[string]string, with the key as the filename and the value as the SQL (as a first thought).
Re:What ORMs have taught me: just learn SQL
by NDizzle on Monday August 04, 2014 @08:40PM
(#8134910)
Forgive my ignorance as I'm not very familiar with golang, but what you're describing above looks (to me) like a parameterized query. Nothing real fancy about that. I'd assume that Go has support for parameterized queries already.