feat: add generator skip option for table columns

Signed-off-by: Alexander Trost <galexrt@googlemail.com>
This commit is contained in:
Alexander Trost 2024-12-26 15:03:42 +01:00
parent f9ed359785
commit 60ba05b6fb
No known key found for this signature in database
GPG key ID: 5CF1D4600D4CBFDF
5 changed files with 73 additions and 9 deletions

View file

@ -217,6 +217,17 @@ func processTableSQLBuilder(fileTypes, dirPath string,
return insertedRowAlias(dialect)
},
"golangComment": formatGolangComment,
"columnList": func(columns []metadata.Column) string {
names := []string{}
for _, col := range columns {
bc := tableSQLBuilder.Column(col)
if bc.Skip {
continue
}
names = append(names, bc.Name+"Column")
}
return strings.Join(names, ", ")
},
})
if err != nil {
return fmt.Errorf("failed to generate table sql builder type %s: %w", tableSQLBuilder.TypeName, err)