From a126ec19368d7c8ea97fe3b521cb2318a7dcb215 Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Wed, 19 Aug 2020 09:34:47 -0700 Subject: [PATCH] Make deserializer interface private I'd like to avoid people using this for the time being. --- decoder.go | 8 ++++---- deserializer.go | 4 ++-- reader.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/decoder.go b/decoder.go index c19be9d..bf135af 100644 --- a/decoder.go +++ b/decoder.go @@ -56,7 +56,7 @@ func (d *decoder) decode(offset uint, result reflect.Value, depth int) (uint, er return d.decodeFromType(typeNum, size, newOffset, result, depth+1) } -func (d *decoder) decodeToDeserializer(offset uint, dser Deserializer, depth int) (uint, error) { +func (d *decoder) decodeToDeserializer(offset uint, dser deserializer, depth int) (uint, error) { if depth > maximumDataStructureDepth { return 0, newInvalidDatabaseError("exceeded maximum data structure depth; database is likely corrupt") } @@ -173,7 +173,7 @@ func (d *decoder) decodeFromTypeToDeserializer( dtype dataType, size uint, offset uint, - dser Deserializer, + dser deserializer, depth int, ) (uint, error) { // For these types, size has a special meaning @@ -564,7 +564,7 @@ func (d *decoder) decodeMap( func (d *decoder) decodeMapToDeserializer( size uint, offset uint, - dser Deserializer, + dser deserializer, depth int, ) (uint, error) { err := dser.StartMap(size) @@ -645,7 +645,7 @@ func (d *decoder) decodeSlice( func (d *decoder) decodeSliceToDeserializer( size uint, offset uint, - dser Deserializer, + dser deserializer, depth int, ) (uint, error) { err := dser.StartSlice(size) diff --git a/deserializer.go b/deserializer.go index 0428ebb..542c00e 100644 --- a/deserializer.go +++ b/deserializer.go @@ -2,7 +2,7 @@ package maxminddb import "math/big" -// Deserializer is an interface for a type that deserializes an MaxMind DB +// deserializer is an interface for a type that deserializes an MaxMind DB // data record to some other type. This exists as an alternative to the // standard reflection API. // @@ -13,7 +13,7 @@ import "math/big" // This interface and the associated unmarshaling code is EXPERIMENTAL! // It is not currently covered by any Semantic Versioning guarantees. // Use at your own risk. -type Deserializer interface { +type deserializer interface { StartSlice(uint) error StartMap(uint) error End() error diff --git a/reader.go b/reader.go index 210c73e..7b33ace 100644 --- a/reader.go +++ b/reader.go @@ -227,7 +227,7 @@ func (r *Reader) decode(offset uintptr, result interface{}) error { return errors.New("result param must be a pointer") } - if dser, ok := result.(Deserializer); ok { + if dser, ok := result.(deserializer); ok { _, err := r.decoder.decodeToDeserializer(uint(offset), dser, 0) return err }