Skip to content

Commit

Permalink
feat: ORM生成新增表字段声明
Browse files Browse the repository at this point in the history
  • Loading branch information
zodial committed Sep 8, 2023
1 parent 54e3249 commit 361d2cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions console/commands/orm/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,9 @@ func genOrmStruct(table string, columns []tableColumn, conf Conf, relationships
}
str += "\n}\n\n"
// 声明表字段
str += "type {TableName}Field string\nvar (\n"
str += "var (\n"
for _, column := range columns {
str += fmt.Sprintf("{TableName}Field%s {TableName}Field = \"%s\"\n", parser.StringToHump(column.COLUMN_NAME), column.COLUMN_NAME)
str += fmt.Sprintf("{TableName}Field%s = \"%s\"\n", parser.StringToHump(column.COLUMN_NAME), column.COLUMN_NAME)
}
str += ")"

Expand Down
4 changes: 2 additions & 2 deletions console/commands/pgorm/pgsql.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,9 @@ func genOrmStruct(table string, columns []tableColumn, conf Conf, relationships
}
str += "\n}\n\n"
// 声明表字段
str += "type {TableName}Field string\nvar (\n"
str += "var (\n"
for _, column := range columns {
str += fmt.Sprintf("{TableName}Field%s {TableName}Field = \"%s\"\n", parser.StringToHump(column.ColumnName), column.ColumnName)
str += fmt.Sprintf("{TableName}Field%s = \"%s\"\n", parser.StringToHump(column.ColumnName), column.ColumnName)
}
str += ")"

Expand Down

0 comments on commit 361d2cf

Please sign in to comment.