fieldmask-utils icon indicating copy to clipboard operation
fieldmask-utils copied to clipboard

not support time.Time

Open EchoGroot opened this issue 1 year ago • 3 comments

time.Time transport to empty map by structx.StructToMapByFieldMask image

println(fmt.Sprintf("%T", updateField["CreateTime"]))----------> map[string]interface {}

EchoGroot avatar Sep 13 '22 06:09 EchoGroot

I assume you refer to this time.Time struct: https://cs.opensource.google/go/go/+/master:src/time/time.go;l=129;drc=f78efc0178d51c02beff8a8203910dc0a9c6e953

All of the fields in this struct are private. Copying private fields is not supported at this moment.

mennanov avatar Sep 15 '22 05:09 mennanov

This way can solve my problem. copy#StructToMap() image

EchoGroot avatar Sep 16 '22 03:09 EchoGroot

I'll work on a possible solution that would solve this issue in general, not just for time.Time structs.

mennanov avatar Sep 19 '22 21:09 mennanov

Please, take a look at PR https://github.com/mennanov/fieldmask-utils/pull/28

Will it work for you?

mennanov avatar Sep 20 '22 18:09 mennanov

yes it work,thanks

EchoGroot avatar Sep 21 '22 01:09 EchoGroot