table is now required

This commit is contained in:
Simon Vieille 2024-03-18 09:01:50 +01:00
parent e24f7f3dc0
commit c493ad89da
Signed by: deblan
GPG key ID: 579388D585F70417

View file

@ -19,12 +19,14 @@ type App struct {
func (a *App) ApplyRule(c config.SchemaConfigData, globalColumns map[string]string, generators map[string][]string) error {
var query string
if c.Table == "" {
return errors.New("Table must be defined")
}
if c.Query != "" {
query = c.Query
} else if c.Table != "" {
query = fmt.Sprintf("SELECT * FROM %s", c.Table)
} else {
return errors.New("No query and no table defined")
query = fmt.Sprintf("SELECT * FROM %s", c.Table)
}
if len(c.PrimaryKey) == 0 {