mirror of
https://github.com/astaxie/beego.git
synced 2025-07-06 06:00:18 +00:00
add support for time.Time pointer in struct types
Allow to use pointer *time.Time as a type in combination with orm tags in struct. This enables to treat them as "empty" in JSON marshaling/unmarshaling when using 'json:"null,omitempty'.
This commit is contained in:
@ -137,6 +137,8 @@ func getFieldType(val reflect.Value) (ft int, err error) {
|
||||
ft = TypeBooleanField
|
||||
case reflect.TypeOf(new(string)):
|
||||
ft = TypeCharField
|
||||
case reflect.TypeOf(new(time.Time)):
|
||||
ft = TypeDateTimeField
|
||||
default:
|
||||
elm := reflect.Indirect(val)
|
||||
switch elm.Kind() {
|
||||
|
Reference in New Issue
Block a user