forked from deblan/database-anonymizer
table is now required
This commit is contained in:
parent
e24f7f3dc0
commit
c493ad89da
1 changed files with 5 additions and 3 deletions
|
|
@ -19,12 +19,14 @@ type App struct {
|
||||||
func (a *App) ApplyRule(c config.SchemaConfigData, globalColumns map[string]string, generators map[string][]string) error {
|
func (a *App) ApplyRule(c config.SchemaConfigData, globalColumns map[string]string, generators map[string][]string) error {
|
||||||
var query string
|
var query string
|
||||||
|
|
||||||
|
if c.Table == "" {
|
||||||
|
return errors.New("Table must be defined")
|
||||||
|
}
|
||||||
|
|
||||||
if c.Query != "" {
|
if c.Query != "" {
|
||||||
query = c.Query
|
query = c.Query
|
||||||
} else if c.Table != "" {
|
|
||||||
query = fmt.Sprintf("SELECT * FROM %s", c.Table)
|
|
||||||
} else {
|
} else {
|
||||||
return errors.New("No query and no table defined")
|
query = fmt.Sprintf("SELECT * FROM %s", c.Table)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(c.PrimaryKey) == 0 {
|
if len(c.PrimaryKey) == 0 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue