deserializer.go 951 B

12345678910111213141516171819202122232425262728293031
  1. package maxminddb
  2. import "math/big"
  3. // deserializer is an interface for a type that deserializes an MaxMind DB
  4. // data record to some other type. This exists as an alternative to the
  5. // standard reflection API.
  6. //
  7. // This is fundamentally different than the Unmarshaler interface that
  8. // several packages provide. A Deserializer will generally create the
  9. // final struct or value rather than unmarshaling to itself.
  10. //
  11. // This interface and the associated unmarshaling code is EXPERIMENTAL!
  12. // It is not currently covered by any Semantic Versioning guarantees.
  13. // Use at your own risk.
  14. type deserializer interface {
  15. ShouldSkip(offset uintptr) (bool, error)
  16. StartSlice(size uint) error
  17. StartMap(size uint) error
  18. End() error
  19. String(string) error
  20. Float64(float64) error
  21. Bytes([]byte) error
  22. Uint16(uint16) error
  23. Uint32(uint32) error
  24. Int32(int32) error
  25. Uint64(uint64) error
  26. Uint128(*big.Int) error
  27. Bool(bool) error
  28. Float32(float32) error
  29. }