e4988b71 by supar

Add property colDefault to fieldInfo object, set its true if there is

orm configuration default `orm:"default(1)"`
1 parent 9c07332c
...@@ -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
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!