register_ext.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
  2. // Use of this source code is governed by a MIT license found in the LICENSE file.
  3. package codec
  4. import "reflect"
  5. // This file exists, so that the files for specific formats do not all import reflect.
  6. // This just helps us ensure that reflect package is isolated to a few files.
  7. // SetInterfaceExt sets an extension
  8. func (h *JsonHandle) SetInterfaceExt(rt reflect.Type, tag uint64, ext InterfaceExt) (err error) {
  9. return h.SetExt(rt, tag, makeExt(ext))
  10. }
  11. // SetInterfaceExt sets an extension
  12. func (h *CborHandle) SetInterfaceExt(rt reflect.Type, tag uint64, ext InterfaceExt) (err error) {
  13. return h.SetExt(rt, tag, makeExt(ext))
  14. }
  15. // SetBytesExt sets an extension
  16. func (h *MsgpackHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) {
  17. return h.SetExt(rt, tag, makeExt(ext))
  18. }
  19. // SetBytesExt sets an extension
  20. func (h *SimpleHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) {
  21. return h.SetExt(rt, tag, makeExt(ext))
  22. }
  23. // SetBytesExt sets an extension
  24. func (h *BincHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) {
  25. return h.SetExt(rt, tag, makeExt(ext))
  26. }
  27. // func (h *XMLHandle) SetInterfaceExt(rt reflect.Type, tag uint64, ext InterfaceExt) (err error) {
  28. // return h.SetExt(rt, tag, &interfaceExtWrapper{InterfaceExt: ext})
  29. // }