eaigner / hood

Database agnostic ORM for Go
MIT License
710 stars 52 forks source link

Queried results end up camelcased instead of underscored #69

Closed andriussev closed 11 years ago

andriussev commented 11 years ago

All the results with underscore names become camelcased and are not added to the returned struct if it has underscored names. When creating the table, no warning is given about this and the table columns are not converted to camelcase either. No mention about this in the documentation.

eaigner commented 11 years ago

Why would a struct have snake cased (underscored) names?

eaigner commented 11 years ago

snake_case is C style, Go uses CamelCase

eaigner commented 11 years ago

Furthermore, you can't unpack to a snake_cased name, because it would be a private struct field (because it's lowercase)

andriussev commented 11 years ago

Well, there's no error in creating variables that have underscores. Like "User_id". If the library converted those variable names to camelcase when creating table, then I would get it. But it creates the table with underscores and then does not let to parse the results from the table because it converts it to camelcase when parsing, then it's a problem, in my opinion. It at least deserves a mention in the documentation.

eaigner commented 11 years ago

I'd also say that this is a doc fix.