Skip to content

Commit 791db99

Browse files
committed
Rename RecordOffset to Offset
1 parent c075ec6 commit 791db99

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

reader_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ func TestDecoder(t *testing.T) {
311311
require.NoError(t, result.Err())
312312
require.True(t, result.Found())
313313

314-
res := reader.LookupOffset(result.RecordOffset())
314+
res := reader.LookupOffset(result.Offset())
315315
require.NoError(t, res.Decode(&testV))
316316
verify(testV)
317317
}
@@ -564,7 +564,7 @@ func TestNestedOffsetDecode(t *testing.T) {
564564
TimeZoneOffset uintptr `maxminddb:"time_zone"`
565565
} `maxminddb:"location"`
566566
}
567-
res := db.LookupOffset(result.RecordOffset())
567+
res := db.LookupOffset(result.Offset())
568568
require.NoError(t, res.Decode(&root))
569569
assert.InEpsilon(t, 51.5142, root.Location.Latitude, 1e-10)
570570

result.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,14 @@ func (r Result) Found() bool {
107107
return r.err == nil && r.offset != notFound
108108
}
109109

110-
// RecordOffset returns the offset of the record in the database. This can be
111-
// passed to ReaderDecode. It can also be used as a unique identifier for the
112-
// data record in the particular database to cache the data record across
113-
// lookups. Note that while the offset uniquely identifies the data record,
114-
// other data in Result may differ between lookups. The offset is only valid
115-
// for the current database version. If you update the database file, you must
116-
// invalidate any cache associated with the previous version.
117-
func (r Result) RecordOffset() uintptr {
110+
// Offset returns the offset of the record in the database. This can be
111+
// passed to (*Reader).LookupOffset. It can also be used as a unique
112+
// identifier for the data record in the particular database to cache the data
113+
// record across lookups. Note that while the offset uniquely identifies the
114+
// data record, other data in Result may differ between lookups. The offset
115+
// is only valid for the current database version. If you update the database
116+
// file, you must invalidate any cache associated with the previous version.
117+
func (r Result) Offset() uintptr {
118118
return uintptr(r.offset)
119119
}
120120

0 commit comments

Comments
 (0)