Generate the TableName() methods for table_prefix is not empty #11

Closed
azhai wants to merge 4 commits from (deleted):dev/azhai into main
First-time contributor
  • 当table_prefix不为空时,为它们生成TableName()方法。

需要在模板中传递来自配置文件的Target参数。

* 当table_prefix不为空时,为它们生成TableName()方法。 需要在模板中传递来自配置文件的Target参数。
Author
First-time contributor
  • 添加Makefile和make.bat(用于Windows),命令行下输入make回车即可编译项目
  • 将RunReverse方法设置为公开,方便其他程序复用
  • 生成的代码包名不再固定为models,而是和目标文件夹同名
  • 对生成的代码进行美化,包括代码格式化和引用包分组为go内置标准包和第三方包

TODO:

  • 加入字段的json标注 (DONE)
  • 加入TableComment()方法作为数据表描述,相应地增加两个接口ITableName和ITableComment
  • 对比Model和Mixin之间的字段,将已知的Mixin内嵌进Model,即自动标注extends的功能
* 添加Makefile和make.bat(用于Windows),命令行下输入make回车即可编译项目 * 将RunReverse方法设置为公开,方便其他程序复用 * 生成的代码包名不再固定为models,而是和目标文件夹同名 * 对生成的代码进行美化,包括代码格式化和引用包分组为go内置标准包和第三方包 TODO: * ~~加入字段的json标注~~ (DONE) * 加入TableComment()方法作为数据表描述,相应地增加两个接口ITableName和ITableComment * 对比Model和Mixin之间的字段,将已知的Mixin内嵌进Model,即自动标注extends的功能
azhai changed title from WIP: Generate the TableName() methods for table_prefix is not empty to Generate the TableName() methods for table_prefix is not empty 2020-04-14 04:03:37 +00:00
lunny reviewed 2020-04-14 06:15:00 +00:00
Dismissed
@ -50,2 +52,4 @@
{{end}}
}
{{if ne $table_prefix ""}}
Owner

We could use names.NewPrefixMapper, so the changes are unnecessary.

We could use `names.NewPrefixMapper`, so the changes are unnecessary.
lunny added the
feature
label 2020-04-14 06:17:09 +00:00
lunny reviewed 2020-04-14 06:18:52 +00:00
Dismissed
@ -327,0 +324,4 @@
func WriteCodeFile(fileName string, sourceCode []byte) ([]byte, error) {
var err error
// Formart/Prettify the code 格式化代码
if sourceCode, err = format.Source(sourceCode); err != nil {
Owner

The format is only for golang?

The `format` is only for golang?
Owner

Could you add some tests?

Could you add some tests?
Owner

We should have options to generate json tag or not.

We should have options to generate `json` tag or not.
lunny added this to the 0.1 milestone 2020-04-14 06:21:31 +00:00
azhai closed this pull request 2021-05-25 00:26:41 +00:00
Some checks are pending
continuous-integration/drone/pr Build is passing
checks / check and test*
Required

Pull request closed

Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: xorm/reverse#11
No description provided.