mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
mcclient: options: accomodate time.Time type
This commit is contained in:
@@ -3,6 +3,7 @@ package options
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/gotypes"
|
||||
@@ -88,6 +89,11 @@ func optionsStructRvToParams(rv reflect.Value) (*jsonutils.JSONDict, error) {
|
||||
if ft.Anonymous {
|
||||
continue
|
||||
}
|
||||
if f.Type() == gotypes.TimeType {
|
||||
t := f.Interface().(time.Time)
|
||||
p.Set(name, jsonutils.NewTimeString(t))
|
||||
continue
|
||||
}
|
||||
// TODO
|
||||
msg := fmt.Sprintf("do not know what to do with non-anonymous struct field: %s", ft.Name)
|
||||
panic(msg)
|
||||
|
||||
Reference in New Issue
Block a user