Closed BTBurke closed 7 years ago
Thanks for your ideas!
I didn't implement point 3 on this. That function might be specific to my use case and it's fairly easy to construct it in my own API from what gountries already provides. The query indexes yielded a pretty good speedup even without using any fancy data structures. I just used a simple map[string]string
to provide lookups for Alpha2, Alpha3, and common name. Query time is reduced by 99%.
I'm planning on using your library as part of an API and I was going to make a few changes to get faster lookups and embed the data directly into the binary to make it easier to deploy. Interested in a pull request?
Planned features:
populateCountries
orpopulateSubdivisions
it checks the bindata first and then falls back to the data directory.This could simplify some of the query functions by using the tree to do lookups, rather than looping through all of the available data.
I'm going to fork your library and work on this a little bit. Let me know if you have any other ideas.