mirror of
https://gitee.com/johng/gf
synced 2026-06-06 02:25:47 +08:00
enhance: add ORM tag to the entity result of command gen dao to make entity assignment more faster (#3454)
This commit is contained in:
@ -135,9 +135,14 @@ func generateStructFieldDefinition(
|
||||
" #" + gstr.CaseCamel(newFiledName),
|
||||
" #" + localTypeNameStr,
|
||||
}
|
||||
attrLines = append(attrLines, " #"+fmt.Sprintf(tagKey+`json:"%s"`, jsonTag))
|
||||
attrLines = append(attrLines, " #"+fmt.Sprintf(`description:"%s"`+tagKey, descriptionTag))
|
||||
attrLines = append(attrLines, " #"+fmt.Sprintf(`// %s`, formatComment(field.Comment)))
|
||||
attrLines = append(attrLines, fmt.Sprintf(` #%sjson:"%s"`, tagKey, jsonTag))
|
||||
// orm tag
|
||||
if !in.IsDo {
|
||||
// entity
|
||||
attrLines = append(attrLines, fmt.Sprintf(` #orm:"%s"`, field.Name))
|
||||
}
|
||||
attrLines = append(attrLines, fmt.Sprintf(` #description:"%s"%s`, descriptionTag, tagKey))
|
||||
attrLines = append(attrLines, fmt.Sprintf(` #// %s`, formatComment(field.Comment)))
|
||||
|
||||
for k, v := range attrLines {
|
||||
if in.NoJsonTag {
|
||||
|
||||
@ -10,11 +10,11 @@ import (
|
||||
|
||||
// TableUser is the golang structure for table table_user.
|
||||
type TableUser struct {
|
||||
Id uint `json:"ID" ` // User ID
|
||||
Passport string `json:"PASSPORT" ` // User Passport
|
||||
Password string `json:"PASSWORD" ` // User Password
|
||||
Nickname string `json:"NICKNAME" ` // User Nickname
|
||||
Score float64 `json:"SCORE" ` // Total score amount.
|
||||
CreateAt *gtime.Time `json:"CREATE_AT" ` // Created Time
|
||||
UpdateAt *gtime.Time `json:"UPDATE_AT" ` // Updated Time
|
||||
Id uint `json:"ID" orm:"id" ` // User ID
|
||||
Passport string `json:"PASSPORT" orm:"passport" ` // User Passport
|
||||
Password string `json:"PASSWORD" orm:"password" ` // User Password
|
||||
Nickname string `json:"NICKNAME" orm:"nickname" ` // User Nickname
|
||||
Score float64 `json:"SCORE" orm:"score" ` // Total score amount.
|
||||
CreateAt *gtime.Time `json:"CREATE_AT" orm:"create_at" ` // Created Time
|
||||
UpdateAt *gtime.Time `json:"UPDATE_AT" orm:"update_at" ` // Updated Time
|
||||
}
|
||||
|
||||
@ -11,11 +11,11 @@ import (
|
||||
|
||||
// TableUser is the golang structure for table table_user.
|
||||
type TableUser struct {
|
||||
Id int64 `json:"id" ` // User ID
|
||||
Passport string `json:"passport" ` // User Passport
|
||||
Password string `json:"password" ` // User Password
|
||||
Nickname string `json:"nickname" ` // User Nickname
|
||||
Score decimal.Decimal `json:"score" ` // Total score amount.
|
||||
CreateAt *gtime.Time `json:"createAt" ` // Created Time
|
||||
UpdateAt *gtime.Time `json:"updateAt" ` // Updated Time
|
||||
Id int64 `json:"id" orm:"id" ` // User ID
|
||||
Passport string `json:"passport" orm:"passport" ` // User Passport
|
||||
Password string `json:"password" orm:"password" ` // User Password
|
||||
Nickname string `json:"nickname" orm:"nickname" ` // User Nickname
|
||||
Score decimal.Decimal `json:"score" orm:"score" ` // Total score amount.
|
||||
CreateAt *gtime.Time `json:"createAt" orm:"create_at" ` // Created Time
|
||||
UpdateAt *gtime.Time `json:"updateAt" orm:"update_at" ` // Updated Time
|
||||
}
|
||||
|
||||
@ -10,9 +10,9 @@ import (
|
||||
|
||||
// Issue2746 is the golang structure for table issue2746.
|
||||
type Issue2746 struct {
|
||||
Id uint `json:"ID" ` // User ID
|
||||
Nickname string `json:"NICKNAME" ` // User Nickname
|
||||
Tag *gjson.Json `json:"TAG" ` //
|
||||
Info string `json:"INFO" ` //
|
||||
Tag2 *gjson.Json `json:"TAG_2" ` // Tag2
|
||||
Id uint `json:"ID" orm:"id" ` // User ID
|
||||
Nickname string `json:"NICKNAME" orm:"nickname" ` // User Nickname
|
||||
Tag *gjson.Json `json:"TAG" orm:"tag" ` //
|
||||
Info string `json:"INFO" orm:"info" ` //
|
||||
Tag2 *gjson.Json `json:"TAG_2" orm:"tag2" ` // Tag2
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user