-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can I generate model with pointer fields? gf gen dao #4119
Comments
And now I manually edit the entity dao files to mark the fields as pointers, but it's a good idea. |
good idea. gf/cmd/gf/internal/cmd/gendao/gendao_structure.go Lines 100 to 109 in e0f7348
need to add new config field ? localTypeNameStr = string(localTypeName)
nullToPtr := true // need new config field to enabled null to pointer.
if nullToPtr && field.Null && !strings.HasPrefix(localTypeNameStr, "*") {
localTypeNameStr = "*" + localTypeNameStr
}
switch localTypeName {
case gdb.LocalTypeDate, gdb.LocalTypeTime, gdb.LocalTypeDatetime: |
Thanks! Let me have a try. |
Description
Thanks for the great work! When using "gf gen dao", the fields of mysql are not null, could you please add a config to make them as pointers? Because our system contains lots of nullable fields and existed logics using the nullable. So I cannot directly make them as not-null.
Additional
No response
The text was updated successfully, but these errors were encountered: