corrected 'skip table generation' check

This commit is contained in:
Jay 2022-12-01 22:28:28 +05:30
parent bda94469ea
commit 199bb2a20a
2 changed files with 10 additions and 10 deletions

2
.gitignore vendored
View file

@ -22,3 +22,5 @@ gen
.gen .gen
.docker .docker
.env .env
.tempTestDir
.gentestdata3

View file

@ -67,28 +67,26 @@ func processSQLBuilder(dirPath string, dialect jet.Dialect, schemaMetaData metad
} }
func processTableSQLBuilderSetSchema(dirPath string, schemaMetadata metadata.Schema, builderTemplate SQLBuilder) { func processTableSQLBuilderSetSchema(dirPath string, schemaMetadata metadata.Schema, builderTemplate SQLBuilder) {
if schemaMetadata.IsEmpty() {
return
}
err := utils.EnsureDirPath(dirPath)
throw.OnError(err)
var builders []TableSQLBuilder var builders []TableSQLBuilder
for _, tm := range schemaMetadata.TablesMetaData { for _, tm := range schemaMetadata.TablesMetaData {
table := builderTemplate.Table(tm)
builders = append(builders, table)
table := builderTemplate.Table(tm)
if table.Skip { if table.Skip {
continue continue
} }
builders = append(builders, table)
} }
if len(builders) == 0 { if len(builders) == 0 {
return return
} }
fmt.Println("Generating global `SetSchema` method...") err := utils.EnsureDirPath(dirPath)
throw.OnError(err)
fmt.Println("Generating global `SetSchema` method")
schemaIdentifier := utils.ToGoIdentifier(schemaMetadata.Name) schemaIdentifier := utils.ToGoIdentifier(schemaMetadata.Name)
funcPath := path.Join(dirPath, builders[0].Path) funcPath := path.Join(dirPath, builders[0].Path)