Documentation
¶
Overview ¶
Package mmdbtype provides types used within the MaxMind DB format.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bool ¶
type Bool bool
Bool is the MaxMind DB boolean type.
func (*Bool) UnmarshalMaxMindDB ¶ added in v1.1.0
UnmarshalMaxMindDB implements the mmdbdata.Unmarshaler interface.
type Bytes ¶
type Bytes []byte
Bytes is the MaxMind DB bytes type.
func (*Bytes) UnmarshalMaxMindDB ¶ added in v1.1.0
UnmarshalMaxMindDB implements the mmdbdata.Unmarshaler interface.
type DataType ¶
type DataType interface {
Copy() DataType
Equal(DataType) bool
WriteTo(writer) (int64, error)
// contains filtered or unexported methods
}
DataType represents a MaxMind DB data type.
type Float32 ¶
type Float32 float32
Float32 is the MaxMind DB float type.
func (*Float32) UnmarshalMaxMindDB ¶ added in v1.1.0
UnmarshalMaxMindDB implements the mmdbdata.Unmarshaler interface.
type Float64 ¶
type Float64 float64
Float64 is the MaxMind DB double type.
func (*Float64) UnmarshalMaxMindDB ¶ added in v1.1.0
UnmarshalMaxMindDB implements the mmdbdata.Unmarshaler interface.
type Int32 ¶
type Int32 int32
Int32 is the MaxMind DB signed 32-bit integer type.
func (*Int32) UnmarshalMaxMindDB ¶ added in v1.1.0
UnmarshalMaxMindDB implements the mmdbdata.Unmarshaler interface.
type Map ¶
Map is the MaxMind DB map type.
func (*Map) UnmarshalMaxMindDB ¶ added in v1.1.0
UnmarshalMaxMindDB implements the mmdbdata.Unmarshaler interface.
type Pointer ¶
type Pointer uint32
Pointer is the MaxMind DB pointer type for internal use in the writer. You should not use this type in data structures that you pass to methods on mmdbwriter.Tree. Doing so may result in a corrupt database.
func (Pointer) WrittenSize ¶
WrittenSize is the actual total size of the pointer in the database data section.
type Slice ¶
type Slice []DataType
Slice is the MaxMind DB array type.
func (*Slice) UnmarshalMaxMindDB ¶ added in v1.1.0
UnmarshalMaxMindDB implements the mmdbdata.Unmarshaler interface.
type String ¶
type String string
String is the MaxMind DB string type.
func (*String) UnmarshalMaxMindDB ¶ added in v1.1.0
UnmarshalMaxMindDB implements the mmdbdata.Unmarshaler interface.
type Uint16 ¶
type Uint16 uint16
Uint16 is the MaxMind DB unsigned 16-bit integer type.
func (*Uint16) UnmarshalMaxMindDB ¶ added in v1.1.0
UnmarshalMaxMindDB implements the mmdbdata.Unmarshaler interface.
type Uint32 ¶
type Uint32 uint32
Uint32 is the MaxMind DB unsigned 32-bit integer type.
func (*Uint32) UnmarshalMaxMindDB ¶ added in v1.1.0
UnmarshalMaxMindDB implements the mmdbdata.Unmarshaler interface.
type Uint64 ¶
type Uint64 uint64
Uint64 is the MaxMind DB unsigned 64-bit integer type.
func (*Uint64) UnmarshalMaxMindDB ¶ added in v1.1.0
UnmarshalMaxMindDB implements the mmdbdata.Unmarshaler interface.
type Uint128 ¶
Uint128 is the MaxMind DB unsigned 128-bit integer type.
func (*Uint128) UnmarshalMaxMindDB ¶ added in v1.1.0
UnmarshalMaxMindDB implements the mmdbdata.Unmarshaler interface.
type Unmarshaler ¶ added in v1.1.0
type Unmarshaler struct {
// contains filtered or unexported fields
}
Unmarshaler implements the mmdbdata.Unmarshaler interface for converting MMDB data back into mmdbtype.DataType values. This is used when loading existing MMDB files to reconstruct the original data structures.
The Unmarshaler caches decoded complex types (Map, Slice, Uint128) at all nesting levels to improve performance when loading databases with shared nested data structures. Simple scalar types are not cached as they are cheap to decode.
The zero value of Unmarshaler is safe to use and will unmarshal data without caching. Use NewUnmarshaler() to create an Unmarshaler with caching enabled for better performance when loading full databases.
func NewUnmarshaler ¶ added in v1.1.0
func NewUnmarshaler() *Unmarshaler
NewUnmarshaler creates a new Unmarshaler with caching enabled for converting MMDB data to mmdbtype values. The cache improves performance when loading databases with shared data structures by avoiding redundant decoding.
func (*Unmarshaler) Clear ¶ added in v1.1.0
func (u *Unmarshaler) Clear()
Clear resets the unmarshaler state for reuse.
func (*Unmarshaler) Result ¶ added in v1.1.0
func (u *Unmarshaler) Result() DataType
Result returns the final unmarshaled value.
func (*Unmarshaler) UnmarshalMaxMindDB ¶ added in v1.1.0
func (u *Unmarshaler) UnmarshalMaxMindDB(decoder *mmdbdata.Decoder) error
UnmarshalMaxMindDB implements the mmdbdata.Unmarshaler interface.