Skip to content

Commit

Permalink
chore: merge variable declarations and condition
Browse files Browse the repository at this point in the history
Signed-off-by: rogerogers <rogers@rogerogers.com>
  • Loading branch information
rogerogers committed Nov 3, 2023
1 parent e473ab0 commit 8ff449d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 4 additions & 2 deletions cmd/dynamic/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ func parsePass(da *config.ModelArgument, pass string) error {
f.BoolVar(&da.FieldSignable, consts.Signable, false, "")
f.BoolVar(&da.FieldWithTypeTag, consts.TypeTag, false, "")
f.BoolVar(&da.FieldWithIndexTag, consts.IndexTag, false, "")
var tables utils.FlagStringSlice
var (
tables utils.FlagStringSlice
excludeTables utils.FlagStringSlice
)
f.Var(&tables, consts.Tables, "")
var excludeTables utils.FlagStringSlice
f.Var(&excludeTables, consts.ExcludeTables, "")
if err := f.Parse(utils.StringSliceSpilt([]string{pass})); err != nil {
return err
Expand Down
6 changes: 2 additions & 4 deletions pkg/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@ func Model(c *config.ModelArgument) error {

if len(c.ExcludeTables) > 0 || c.Type == string(consts.Sqlite) {
genConfig.WithTableNameStrategy(func(tableName string) (targetTableName string) {
if c.Type == string(consts.Sqlite) {
if strings.HasPrefix(tableName, "sqlite") {
return ""
}
if c.Type == string(consts.Sqlite) && strings.HasPrefix(tableName, "sqlite") {
return ""
}
if len(c.ExcludeTables) > 0 {
for _, table := range c.ExcludeTables {
Expand Down

0 comments on commit 8ff449d

Please sign in to comment.