1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 22:30:54 +00:00

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

orm configuration default `orm:"default(1)"`
This commit is contained in:
supar 2014-10-17 12:27:53 +04:00
parent 9c07332cfc
commit e4988b714e

View File

@ -116,6 +116,7 @@ type fieldInfo struct {
null bool null bool
index bool index bool
unique bool unique bool
colDefault bool
initial StrTo initial StrTo
size int size int
auto_now bool auto_now bool
@ -280,6 +281,11 @@ checkType:
fi.pk = attrs["pk"] fi.pk = attrs["pk"]
fi.unique = attrs["unique"] fi.unique = attrs["unique"]
// Mark object property if there is attribute "default" in the orm configuration
if _, ok := tags["default"]; ok {
fi.colDefault = true
}
switch fieldType { switch fieldType {
case RelManyToMany, RelReverseMany, RelReverseOne: case RelManyToMany, RelReverseMany, RelReverseOne:
fi.null = false fi.null = false