27 lines
501 B
Go
27 lines
501 B
Go
|
package utils
|
||
|
|
||
|
import (
|
||
|
"github.com/pkg/errors"
|
||
|
"reflect"
|
||
|
)
|
||
|
|
||
|
// to simplefy add json
|
||
|
|
||
|
type JsonObject struct{
|
||
|
parent *JsonObject
|
||
|
child *JsonObject
|
||
|
value interface{}
|
||
|
|
||
|
}
|
||
|
|
||
|
func (*JsonObject)InsertObj(key string,obj interface{}) error{
|
||
|
if reflect.TypeOf(obj).Kind() != reflect.Map{
|
||
|
return errors.New("wrong parameter")
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
func (*JsonObject)InsertArrary(key string,arr interface{}) error {
|
||
|
if reflect.TypeOf(arr).Kind() != reflect.Array{
|
||
|
return errors.New("wrong parameter")
|
||
|
}
|
||
|
}
|