background/utils/jsonbuilder.go

28 lines
513 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")
}
return nil
}