astaxie/beedb — pull request #47 by gabstv (2014-02-09 04:59:31+00:00)
Title: Make beedb map structs to tables/columns by tags instead of putting underlines before capital letters

Since it's not always that you're working with a fresh database to have liberty on using the most comfortable naming convention for tables and columns, I made beedb recognise "sql" tags to map them any way you need (like mho does with *bson* tags):

type Car struct {
Id int `beedb:"PK" sql:"ID" tname:"CARS"`
Name string `sql:"car_name"`
Type string `sql:"car_type"`
}

The tag *tname* is there if you need to specify the table name as well. There could be a better way for this (sadly the struct itself can't have a tag) so I'm open for suggestions.