diff --git a/mutable_xobject.go b/mutable_xobject.go index be20a95..41f89af 100644 --- a/mutable_xobject.go +++ b/mutable_xobject.go @@ -4,6 +4,16 @@ type MutableXObject struct { XObject } +func NewMxoArray() *MutableXObject { + p:= new(MutableXObject) + return p +} + +func NewMxoObject() *MutableXObject { + p:= new(MutableXObject) + return p +} + func (this *MutableXObject) PushXValue(val *XValue) *MutableXObject{ return this } @@ -23,3 +33,7 @@ func (this *MutableXObject) SetXObject(key string, val *XObject) *MutableXObject func (this *MutableXObject) SetMutableXObject(key string, val *MutableXObject) *MutableXObject{ return this } + +func (this *MutableXObject) AsXObject() *XObject{ + return &this.XObject +} diff --git a/sysutils.go b/sysutils.go index f35e5aa..e88aa58 100644 --- a/sysutils.go +++ b/sysutils.go @@ -1,10 +1,12 @@ package q5 -import "os" -import "net" -import "net/http" -import "time" -import "reflect" +import ( + "os" + "net" + "net/http" + "time" + "reflect" +) func GetDaySeconds(seconds int64) int64 { return 0 @@ -82,3 +84,8 @@ func IsNumberType(v interface{}) bool { return false } } + +func FormatUnixDateTime(sec int64) string { + strTime := time.Unix(sec, 0).Format("2006-01-02 15:04:05") + return strTime +} diff --git a/xvalue.go b/xvalue.go index 34f19ff..5b2ae7a 100644 --- a/xvalue.go +++ b/xvalue.go @@ -19,6 +19,18 @@ type XValue struct _val interface{} } +func NewXInt32(val int32) *XValue { + p := new(XValue) + p.SetInt32(val) + return p +} + +func NewXString(val string) *XValue { + p := new(XValue) + p.SetString(val) + return p +} + func (this *XValue) GetType() int8 { if this._type == XVT_UNDEFINED { return XVT_INT