Open KevinGong2013 opened 2 years ago
https://github.com/leancloud/go-sdk/blob/7d89f2fbc445c585336655a3fd59a3d4704639cc/leancloud/encoding.go#L265-L282
例如自定一个class 如下:
type Foo struct { leancloud.Object Rule struct { Month int `json:"month"` Day int `json:"day"` } `json:"rule"` }
这个Foo对象save以后 rule列应该是 {"month": 1, "day": 1} 而不是{"Month": 1, "Day": 1}
rule
{"month": 1, "day": 1}
{"Month": 1, "Day": 1}
我也遇到一样的问题, 某字段是一个 Array, Array 里放了一堆 struct 对象.
存入库中后发现, 这些 struct 对象都没有读取其 json tag, 而是用了大写开头的字段名.
提了一个 pull request https://github.com/leancloud/go-sdk/pull/52
https://github.com/leancloud/go-sdk/blob/7d89f2fbc445c585336655a3fd59a3d4704639cc/leancloud/encoding.go#L265-L282
例如自定一个class 如下:
这个Foo对象save以后
rule
列应该是{"month": 1, "day": 1}
而不是{"Month": 1, "Day": 1}