refactor: add directoryReferenceSerializationMap map wrapper to handle DirectoryReference serialization
This commit is contained in:
parent
453e8590c7
commit
00157e463c
|
@ -14,9 +14,15 @@ type fileReferenceMap struct {
|
||||||
linkedhashmap.Map
|
linkedhashmap.Map
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type directoryReferenceSerializationMap struct {
|
||||||
|
linkedhashmap.Map
|
||||||
|
}
|
||||||
|
|
||||||
type unmarshalNewInstanceFunc func() interface{}
|
type unmarshalNewInstanceFunc func() interface{}
|
||||||
|
|
||||||
var _ SerializableMetadata = (*directoryReferenceMap)(nil)
|
var _ SerializableMetadata = (*directoryReferenceMap)(nil)
|
||||||
|
var _ SerializableMetadata = (*fileReferenceMap)(nil)
|
||||||
|
var _ msgpack.CustomEncoder = (*directoryReferenceSerializationMap)(nil)
|
||||||
|
|
||||||
func unmarshalMapMsgpack(dec *msgpack.Decoder, m *linkedhashmap.Map, placeholder interface{}, intMap bool) error {
|
func unmarshalMapMsgpack(dec *msgpack.Decoder, m *linkedhashmap.Map, placeholder interface{}, intMap bool) error {
|
||||||
*m = *linkedhashmap.New()
|
*m = *linkedhashmap.New()
|
||||||
|
@ -170,3 +176,7 @@ func (drm *directoryReferenceMap) UnmarshalJSON(bytes []byte) error {
|
||||||
createDirInstance := func() interface{} { return &DirectoryReference{} }
|
createDirInstance := func() interface{} { return &DirectoryReference{} }
|
||||||
return unmarshalMapJson(bytes, &drm.Map, createDirInstance)
|
return unmarshalMapJson(bytes, &drm.Map, createDirInstance)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (frm directoryReferenceSerializationMap) EncodeMsgpack(enc *msgpack.Encoder) error {
|
||||||
|
return marshallMapMsgpack(enc, &frm.Map)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue