MCPcopy Create free account
hub / github.com/oschwald/maxminddb-golang / ReadString

Method ReadString

internal/decoder/decoder.go:63–75  ·  view source on GitHub ↗

ReadString reads the value pointed by the decoder as a string. Returns an error if the database is malformed or if the pointed value is not a string.

()

Source from the content-addressed store, hash-verified

61//
62// Returns an error if the database is malformed or if the pointed value is not a string.
63func (d *Decoder) ReadString() (string, error) {
64 size, offset, err := d.decodeCtrlDataAndFollow(KindString)
65 if err != nil {
66 return "", d.wrapError(err)
67 }
68
69 value, newOffset, err := d.d.decodeString(size, offset)
70 if err != nil {
71 return "", d.wrapError(err)
72 }
73 d.setNextOffset(newOffset)
74 return value, nil
75}
76
77// ReadBytes reads the value pointed by the decoder as bytes.
78//

Calls 4

wrapErrorMethod · 0.95
setNextOffsetMethod · 0.95
decodeStringMethod · 0.80