golint orm

This commit is contained in:
astaxie
2015-09-12 21:46:43 +08:00
parent 542e143e55
commit 68ec133aa8
25 changed files with 574 additions and 501 deletions

View File

@@ -119,8 +119,8 @@ type fieldInfo struct {
colDefault bool
initial StrTo
size int
auto_now bool
auto_now_add bool
autoNow bool
autoNowAdd bool
rel bool
reverse bool
reverseField string
@@ -309,20 +309,20 @@ checkType:
if fi.rel && fi.dbcol {
switch onDelete {
case od_CASCADE, od_DO_NOTHING:
case od_SET_DEFAULT:
case odCascade, odDoNothing:
case odSetDefault:
if initial.Exist() == false {
err = errors.New("on_delete: set_default need set field a default value")
goto end
}
case od_SET_NULL:
case odSetNULL:
if fi.null == false {
err = errors.New("on_delete: set_null need set field null")
goto end
}
default:
if onDelete == "" {
onDelete = od_CASCADE
onDelete = odCascade
} else {
err = fmt.Errorf("on_delete value expected choice in `cascade,set_null,set_default,do_nothing`, unknown `%s`", onDelete)
goto end
@@ -350,9 +350,9 @@ checkType:
fi.unique = false
case TypeDateField, TypeDateTimeField:
if attrs["auto_now"] {
fi.auto_now = true
fi.autoNow = true
} else if attrs["auto_now_add"] {
fi.auto_now_add = true
fi.autoNowAdd = true
}
case TypeFloatField:
case TypeDecimalField: