NewGenerator creates a new generator for the given tables. The tables are sorted by name. pluginName is optional and is used in markdown only
(pluginName string, tables schema.Tables)
| 56 | // NewGenerator creates a new generator for the given tables. |
| 57 | // The tables are sorted by name. pluginName is optional and is used in markdown only |
| 58 | func NewGenerator(pluginName string, tables schema.Tables) *Generator { |
| 59 | sortedTables := make(schema.Tables, 0, len(tables)) |
| 60 | for _, t := range tables { |
| 61 | sortedTables = append(sortedTables, t.Copy(nil)) |
| 62 | } |
| 63 | sortTables(sortedTables) |
| 64 | |
| 65 | return &Generator{ |
| 66 | tables: sortedTables, |
| 67 | pluginName: pluginName, |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | func (g *Generator) Generate(dir string, format Format) error { |
| 72 | if err := os.MkdirAll(dir, os.ModePerm); err != nil { |