This commit is contained in:
aozhiwei 2021-08-12 15:43:51 +08:00
parent d82df9df79
commit 607a4887d0
2 changed files with 7 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package q5
import (
"reflect"
"net/url"
"encoding/json"
)
@ -223,7 +224,7 @@ func (this *XObject) fromInterface(iVal interface{}) *XObject {
this._type = XOT_SIMPLE
this._val = NewXUndefined()
if !this.AsXValue().TryFromInterface(iVal) {
panic("XObject.fromInterface type error2")
panic("XObject.fromInterface type error2 type" + reflect.TypeOf(iVal).String())
}
}
return this

View File

@ -271,6 +271,11 @@ func (this *XValue) ToJsonInterface() interface{} {
}
func (this *XValue) TryFromInterface(val interface{}) bool {
if val == nil {
this._type = XVT_UNDEFINED
this._val = nil
return true
}
switch val.(type) {
case int8:
this.SetInt8(val.(int8))