9 Commits
Author SHA1 Message Date
zhangwenjian d30b9c103f fix🐛: import "time" in a generated model only for fields it declares
The model template imported "time" for any queryable time.Time column,
though whether a column is queryable only shapes the DTO. A queryable
created_at, which the model takes from models.ModelTime rather than
declaring, left the import unused and the generated package failed to
compile.
2026-09-27 16:07:09 +08:00
zhangwenjian d53c8abc6c fix🐛: generate a model and DTOs for any single-column primary key
The model and DTO templates assumed every table's key is an int column named
id. For any other key the generated backend did not compile - the model
embedded models.Model, which supplies Id, skipped the real key column, and
GetId then returned a field that did not exist ("e.Code undefined"). Past the
compile error there was more of the same assumption:

  - GetReq and UpdateReq bound the key with uri:"<json field>", while every
    generated router registers it as :id, so any other name bound nothing;
  - InsertReq tagged the key json:"-", so a key the database does not assign,
    such as a string, could never be supplied;
  - DeleteReq took Ids []int, so a string key could not be deleted.

models.Model now stands in for the key only when the key is exactly an int
named Id; anything else is declared as its own primaryKey field. The key is
bound from :id, accepted from the request body when it is not an int, and
deleted by a list of its own type. A table keyed on an int id renders
byte-for-byte as before.
2026-09-25 19:59:59 +08:00
zgxme f1dfba79e0 [fix](gen) ignore default time type columns in table 2023-09-09 22:59:45 +08:00
horizonzy b52da434bb fix code gen problem. 2022-01-31 13:00:21 +08:00
horizonzy 3cfa7a2767 fix code gen problem. 2022-01-31 12:00:26 +08:00
wenjianzhang 75b529d7b0 ormat🥚 :优化生成模版 2021-03-11 14:56:15 +08:00
zhangwenjian 12be09b4d5 feat✨ :工作流分类 2021-02-26 16:15:35 +08:00
wenjianzhang b8ec705e0a feat✨ :添加行政区域基础数据 2021-02-26 01:05:20 +08:00
wenjianzhang 677e54631a perf👌 : 模版升级 2021-01-14 22:41:49 +08:00