File: type.go

package info (click to toggle)
golang-github-oschwald-maxminddb-golang-v2 2.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,132 kB
  • sloc: perl: 557; makefile: 3
file content (40 lines) | stat: -rw-r--r-- 1,343 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package mmdbdata

import "github.com/oschwald/maxminddb-golang/v2/internal/decoder"

// Kind represents MMDB data kinds.
type Kind = decoder.Kind

// Decoder provides methods for decoding MMDB data.
type Decoder = decoder.Decoder

// DecoderOption configures a Decoder.
type DecoderOption = decoder.DecoderOption

// NewDecoder creates a new Decoder with the given buffer, offset, and options.
// Error messages automatically include contextual information like offset and
// path (e.g., "/city/names/en") with zero impact on successful operations.
func NewDecoder(buffer []byte, offset uint, options ...DecoderOption) *Decoder {
	d := decoder.NewDataDecoder(buffer)
	return decoder.NewDecoder(d, offset, options...)
}

// Kind constants for MMDB data.
const (
	KindExtended  = decoder.KindExtended
	KindPointer   = decoder.KindPointer
	KindString    = decoder.KindString
	KindFloat64   = decoder.KindFloat64
	KindBytes     = decoder.KindBytes
	KindUint16    = decoder.KindUint16
	KindUint32    = decoder.KindUint32
	KindMap       = decoder.KindMap
	KindInt32     = decoder.KindInt32
	KindUint64    = decoder.KindUint64
	KindUint128   = decoder.KindUint128
	KindSlice     = decoder.KindSlice
	KindContainer = decoder.KindContainer
	KindEndMarker = decoder.KindEndMarker
	KindBool      = decoder.KindBool
	KindFloat32   = decoder.KindFloat32
)