Add property colDefault to fieldInfo object, set its true if there is
orm configuration default `orm:"default(1)"`
Showing
1 changed file
with
6 additions
and
0 deletions
| ... | @@ -116,6 +116,7 @@ type fieldInfo struct { | ... | @@ -116,6 +116,7 @@ type fieldInfo struct { |
| 116 | null bool | 116 | null bool |
| 117 | index bool | 117 | index bool |
| 118 | unique bool | 118 | unique bool |
| 119 | colDefault bool | ||
| 119 | initial StrTo | 120 | initial StrTo |
| 120 | size int | 121 | size int |
| 121 | auto_now bool | 122 | auto_now bool |
| ... | @@ -280,6 +281,11 @@ checkType: | ... | @@ -280,6 +281,11 @@ checkType: |
| 280 | fi.pk = attrs["pk"] | 281 | fi.pk = attrs["pk"] |
| 281 | fi.unique = attrs["unique"] | 282 | fi.unique = attrs["unique"] |
| 282 | 283 | ||
| 284 | // Mark object property if there is attribute "default" in the orm configuration | ||
| 285 | if _, ok := tags["default"]; ok { | ||
| 286 | fi.colDefault = true | ||
| 287 | } | ||
| 288 | |||
| 283 | switch fieldType { | 289 | switch fieldType { |
| 284 | case RelManyToMany, RelReverseMany, RelReverseOne: | 290 | case RelManyToMany, RelReverseMany, RelReverseOne: |
| 285 | fi.null = false | 291 | fi.null = false | ... | ... |
-
Please register or sign in to post a comment