oschwald / maxminddb-golang

MaxMind DB Reader for Go
ISC License
576 stars 99 forks source link

How to fetch all items? #54

Closed nexcode closed 5 years ago

nexcode commented 5 years ago

It takes first item:

func main() {
    db, err := maxminddb.Open("GeoIP2-City-Europe.mmdb")
    if err != nil {
        panic(err)
    }

    defer db.Close()

    var res interface{}
    db.Decode(0, &res)

    fmt.Println(res)
}

How do I know which offset is needed for the second item?

oschwald commented 5 years ago

You should be using the Networks method. Decode is only intended to be used with LookupOffset.