You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using tinylib/msgp to add marshaling/unmarshaling to existing structs. This library works very well in my usecase. I appreciate tinylib/msgp's maintainers a lot.
My structs have a lot of map whose keys are not string and MessagePack requires map key to be string. I can replace all these map keys with string but doing this makes my structs lost some of their readability and I have to do some refactoring.
For an example, I have to change the following struct:
type Foo <some type can convert to/from string>
type MyStruct struct {
Map map[Foo]*Bar
}
to
type MyStruct struct {
MapByFoo map[string]*Bar
}
to maintain readability.
tinylib/msgp already has shim directive that allows any type to be (un)marshaled as another type. I use this feature a lot to avoid refactoring my structs. It will be nice that shim directive also transform non-string map key to string so the following code:
I'm using
tinylib/msgp
to add marshaling/unmarshaling to existing structs. This library works very well in my usecase. I appreciatetinylib/msgp
's maintainers a lot.My structs have a lot of
map
whose keys are notstring
and MessagePack requires map key to be string. I can replace all these map keys withstring
but doing this makes my structs lost some of their readability and I have to do some refactoring.For an example, I have to change the following struct:
to
to maintain readability.
tinylib/msgp
already hasshim
directive that allows any type to be (un)marshaled as another type. I use this feature a lot to avoid refactoring my structs. It will be nice thatshim
directive also transform non-string map key to string so the following code:will be generated as
The text was updated successfully, but these errors were encountered: