Commit 9d7184ed authored by Jason Moiron's avatar Jason Moiron

Merge pull request #11 from silasdavis/TableNameMapper

Added TableNameMapper to modl
parents 992aacda aefb3178
......@@ -16,10 +16,14 @@ import (
// TableNameMapper is the function used by AddTable to map struct names to database table names, in analogy
// to sqlx.NameMapper which does the same for struct field name to database column names.
var TableNameMapper = strings.ToLower
// DbMap is the root modl mapping object. Create one of these for each
// database schema you wish to map. Each DbMap contains a list of
// mapped tables.
......@@ -83,7 +87,7 @@ func (m *DbMap) AddTable(i interface{}, name ...string) *TableMap {
t := reflect.TypeOf(i)
// Use sqlx's NameMapper function if no name is supplied
if len(Name) == 0 {
Name = sqlx.NameMapper(t.Name())
Name = TableNameMapper(t.Name())
// check if we have a table for this type already
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment