go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

Modify model templates, removing the placeholders of CreateTime and UpdateTime makes the generated code not working.

Open ttsszzyy opened this issue 2 years ago • 4 comments

image 这里我删除model的vars.tpl的模板,去掉字段生成时忽略的createtime和updatetime,会导致重新生成的代码,所有的model接口都不能正常的工作,insert会报字段不匹配的错误。因为我们的项目,时间都是用int64来表达的。

ttsszzyy avatar Jun 30 '22 05:06 ttsszzyy

image

这里我删除model的vars.tpl的模板,去掉字段生成时忽略的createtime和updatetime,会导致重新生成的代码,所有的model接口都不能正常的工作,insert会报字段不匹配的错误。因为我们的项目,时间都是用int64来表达的。

建议不要用同名字段,使用create_at和update_at替换,没必要在这里和模版做冲突

jsonMark avatar Jun 30 '22 08:06 jsonMark

好像你可以把模版改成CreateAt和UpdateAt,如果你是历史项目的话 没有历史包袱的新项目就别头铁

jsonMark avatar Jun 30 '22 08:06 jsonMark

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Seems like you can change the template to Created_At and Updated_At if you are historical project Don't give up on new projects without historical baggage

Issues-translate-bot avatar Jun 30 '22 08:06 Issues-translate-bot

这里确实存在这个问题,我正在寻找解决方案 That's a problem in model code generation, I'm looking for a solution to solve it.

kesonan avatar Jul 09 '22 15:07 kesonan

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Aug 11 '22 02:08 github-actions[bot]