git.sr.ht/~pingoo/stdx@v0.0.0-20240218134121-094174641f6e/mmdb/deserializer.go (about)

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