News for hackers. Stuff that matters.
Re:Why Generics? by dimgl on Wednesday July 31, 2019 @03:26PM (#20577393)
Developers think ORMs are evil because they've had horrible experiences with ORMs in general. I'm one of them. The only ORM that I enjoyed using was Dapper, and it's barely an ORM.
Re:Why Generics? by runevault on Wednesday July 31, 2019 @03:43PM (#20577612)
Dapper really is such a weird edge case. You still write all the sql, all it does is the conversion from a type to the input parameters and the returned rows into objects where the row names match the parameters of the class. Frankly I feel like that's the right way to build ORMs in all languages that have the facilities to manage it (and maybe those that don't you pass in a function pointer to do the dumping of rows into type for you)
Re:Why Generics? by throwaway8879 on Wednesday July 31, 2019 @04:03PM (#20577871)
The sqlx package is a similar Go wrapper around SQL. Very handy for scanning into structs.
Re:Why Generics? by buildzr on Wednesday July 31, 2019 @04:00PM (#20577838)
What sort of horrible experiences have you actually had with ORMs? Every time I've used one it's been an absolute joy, I hate repeating myself in my DB, in SQL, in mapping code and again in application code. The main thing I see people complaining about is performance edgecases, but for small and mid scale applications these can never take away the massive DRY principle gain good ORMs provide.
Re:Why Generics? by twodave on Wednesday July 31, 2019 @04:01PM (#20577858)
And almost every usage of Dapper relies heavily on generics.
Re:Why Generics? by dimgl on Wednesday July 31, 2019 @04:08PM (#20577929)
There's no denying most C# code makes heavy use of generics, but we've deviated from the actual topic. C# is not Go. Far from it.

I'm not advocating for bringing a Dapper-like library to Go. I'm pretty happy with the solutions we have right now to map data coming from a SQL database into structs in Go. I'm commenting specifically on the argument that Go developers don't like ORMs.