From 199bb2a20adc614c666179241d823fd1a942cff9 Mon Sep 17 00:00:00 2001 From: Jay Date: Thu, 1 Dec 2022 22:28:28 +0530 Subject: [PATCH] corrected 'skip table generation' check --- .gitignore | 4 +++- generator/template/process.go | 16 +++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 4d7da45..a627142 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,6 @@ gen .tests/testdata/ .gen .docker -.env \ No newline at end of file +.env +.tempTestDir +.gentestdata3 \ No newline at end of file diff --git a/generator/template/process.go b/generator/template/process.go index 102c7c0..edac0cb 100644 --- a/generator/template/process.go +++ b/generator/template/process.go @@ -67,28 +67,26 @@ func processSQLBuilder(dirPath string, dialect jet.Dialect, schemaMetaData metad } func processTableSQLBuilderSetSchema(dirPath string, schemaMetadata metadata.Schema, builderTemplate SQLBuilder) { - if schemaMetadata.IsEmpty() { - return - } - - err := utils.EnsureDirPath(dirPath) - throw.OnError(err) var builders []TableSQLBuilder for _, tm := range schemaMetadata.TablesMetaData { - table := builderTemplate.Table(tm) - builders = append(builders, table) + table := builderTemplate.Table(tm) if table.Skip { continue } + + builders = append(builders, table) } if len(builders) == 0 { 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) funcPath := path.Join(dirPath, builders[0].Path)