//------------------------------------------------------------------------------ // // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ package cfg; import "errors" type TestItemBase struct { Id int32 Name string Desc string } const TypeId_TestItemBase = -1631171968 func (*TestItemBase) GetTypeId() int32 { return -1631171968 } func NewTestItemBase(_buf map[string]interface{}) (interface{}, error) { var id string var _ok_ bool if id, _ok_ = _buf["$type"].(string) ; !_ok_ { return nil, errors.New("type id missing") } switch id { case "Item": _v, err := NewTestItem(_buf); if err != nil { return nil, errors.New("testitem") } else { return _v, nil } case "Equipment": _v, err := NewTestEquipment(_buf); if err != nil { return nil, errors.New("testequipment") } else { return _v, nil } case "Decorator": _v, err := NewTestDecorator(_buf); if err != nil { return nil, errors.New("testdecorator") } else { return _v, nil } default: return nil, errors.New("unknown type id") } }