modl
modl copied to clipboard
SelectAll support
Is there a plan to support SelectAll ?
var users []User
err := dbm.SelectAll(&users)
Or how welcome are you for it?
I haven't planned on it. It should be trivial to do with dbm.TableFor(User{}).TableName and some simple sql. I think I'd have to wait and see for the patch, because this is slightly tricky and it's fairly easy to just write the query. The advantage of SelectAll would be that you could do it with an unknown type.
I don't think it's necessary to provide a function for any old SQL that you could produce easily. Maintaining a smaller API has its own benefits. CRUD is repetitive and in some cases easy to get wrong, so those kinds of helpers are okay. I am open to arguments in favor, though.
I agree with you. However, we have a kind of policy not to have any SQL in code. We're reading queries into one holder in setup and use it. Then, it becomes a bit repetitive even for a simple query. Please give a look and let me know if it's good. Thank you!