File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -8,12 +8,6 @@ import (
8
8
"github.com/oschwald/maxminddb-golang"
9
9
)
10
10
11
- type onlyCountry struct {
12
- Country struct {
13
- ISOCode string `maxminddb:"iso_code"`
14
- } `maxminddb:"country"`
15
- }
16
-
17
11
// This example shows how to decode to a struct
18
12
func ExampleReader_Lookup_struct () {
19
13
db , err := maxminddb .Open ("test-data/test-data/GeoIP2-City-Test.mmdb" )
@@ -24,7 +18,12 @@ func ExampleReader_Lookup_struct() {
24
18
25
19
ip := net .ParseIP ("81.2.69.142" )
26
20
27
- var record onlyCountry // Or any appropriate struct
21
+ var record struct {
22
+ Country struct {
23
+ ISOCode string `maxminddb:"iso_code"`
24
+ } `maxminddb:"country"`
25
+ } // Or any appropriate struct
26
+
28
27
err = db .Lookup (ip , & record )
29
28
if err != nil {
30
29
log .Fatal (err )
You can’t perform that action at this time.
0 commit comments