This change improves performance for generating mysql models for databases with large number of tables. In my local testing for a database with about 1000 tables and 140k columns, generation time was reduced from about 1h to less than one second.
22 lines
390 B
Go
22 lines
390 B
Go
package metadata
|
|
|
|
// Table metadata struct
|
|
type Table struct {
|
|
Name string `sql:"primary_key"`
|
|
Columns []Column
|
|
}
|
|
|
|
// MutableColumns returns list of mutable columns for table
|
|
func (t Table) MutableColumns() []Column {
|
|
var ret []Column
|
|
|
|
for _, column := range t.Columns {
|
|
if column.IsPrimaryKey || column.IsGenerated {
|
|
continue
|
|
}
|
|
|
|
ret = append(ret, column)
|
|
}
|
|
|
|
return ret
|
|
}
|