//------------------------------------------------------------------------------ // // 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 MyBeanRewards struct { Id int32 Name string Desc string Price int32 ExpireTime *int32 BatchUseable bool } const TypeId_MyBeanRewards = -97538382 func (*MyBeanRewards) GetTypeId() int32 { return -97538382 } func (_v *MyBeanRewards)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } } { var _ok_ bool; if _v.Desc, _ok_ = _buf["desc"].(string); !_ok_ { err = errors.New("desc error"); return } } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["price"].(float64); !_ok_ { err = errors.New("price error"); return }; _v.Price = int32(_tempNum_) } { var _ok_ bool; var __json_expire_time__ interface{}; if __json_expire_time__, _ok_ = _buf["expire_time"]; !_ok_ || __json_expire_time__ == nil { _v.ExpireTime = nil } else { var __x__ int32; { var _ok_ bool; var _x_ float64; if _x_, _ok_ = __json_expire_time__.(float64); !_ok_ { err = errors.New("__x__ error"); return }; __x__ = int32(_x_) }; _v.ExpireTime = &__x__ }} { var _ok_ bool; if _v.BatchUseable, _ok_ = _buf["batch_useable"].(bool); !_ok_ { err = errors.New("batch_useable error"); return } } return } func DeserializeMyBeanRewards(_buf map[string]interface{}) (*MyBeanRewards, error) { v := &MyBeanRewards{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } }