code: func (m *DbMap) AddTable(i interface{}, name ...string) *TableMap {
  	Name := ""
  	if len(name) > 0 {
  		Name = name[0]
  	}
  
  	t := reflect.TypeOf(i)
  	// Use sqlx's NameMapper function if no name is supplied
  	if len(Name) == 0 {
  		Name = TableNameMapper(t.Name())
  	}
  
  	// check if we have a table for this type already
  	// if so, update the name and return the existing pointer
  	for i := range m.tables {
  		table := m.tables[i]
  		if table.gotype == t {
  			table.TableName = Name
  			return table
  		}
  	}
  
  	tmap := &TableMap{gotype: t, TableName: Name, dbmap: m, mapper: m.mapper}
  	tmap.setupHooks(i)
  
  	n := t.NumField()
  	tmap.Columns = make([]*ColumnMap, 0, n)
  	for i := 0; i < n; i++ {
  		f := t.Field(i)
  		columnName := f.Tag.Get("db")
  		if columnName == "" {
  			columnName = sqlx.NameMapper(f.Name)
  		}
  
  		cm := &ColumnMap{
  			ColumnName: columnName,
  			Transient:  columnName == "-",
  			fieldName:  f.Name,
  			gotype:     f.Type,
  			table:      tmap,
  		}
  		tmap.Columns = append(tmap.Columns, cm)
  		if cm.fieldName == "Version" {
  			tmap.version = tmap.Columns[len(tmap.Columns)-1]
  		}
  	}
  	m.tables = append(m.tables, tmap)
  
  	return tmap
  
  }
docs: // AddTable registers the given interface type with modl. The table name
  // will be given the name of the TypeOf(i), lowercased.
  //
  // This operation is idempotent. If i's type is already mapped, the
  // existing *TableMap is returned.