{"id":13414115,"url":"https://github.com/biter777/countries","last_synced_at":"2025-12-25T18:52:15.582Z","repository":{"id":41063340,"uuid":"182808313","full_name":"biter777/countries","owner":"biter777","description":"Countries - ISO-639, ISO-3166 countries codes with subdivisions and names, ISO-4217 currency designators, ITU-T E.164 IDD phone codes, countries capitals, UN M.49 codes, IANA ccTLD countries domains, FIPS, IOC/NOC and FIFA codes, VERY VERY FAST, compatible with Databases/JSON/BSON/GOB/XML/CSV, Emoji countries flags and currencies, Unicode CLDR.","archived":false,"fork":false,"pushed_at":"2024-05-30T13:54:09.000Z","size":1507,"stargazers_count":382,"open_issues_count":7,"forks_count":72,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-07-31T20:53:32.407Z","etag":null,"topics":["call-codes","cctld","currencies","currency","fifa","fips","go","ioc","iso","iso-3166","iso-3166-1","iso-3166-2","iso-4217","iso-639-1","iso3166","iso3166-1","iso3166-2","iso4217","json","money"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/biter777/countries?tab=doc","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/biter777.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"liberapay":"biter777","ko_fi":"biter777","tidelift":null,"community_bridge":"countries","issuehunt":null,"otechie":null,"custom":["https://www.buymeacoffee.com/CAhuDKg","https://pay.cloudtips.ru/p/94fc4268"]}},"created_at":"2019-04-22T14:47:11.000Z","updated_at":"2024-07-25T07:55:48.000Z","dependencies_parsed_at":"2024-02-29T15:56:27.497Z","dependency_job_id":"58cf6e54-2eb5-436c-b512-cc0824c4ddfe","html_url":"https://github.com/biter777/countries","commit_stats":{"total_commits":342,"total_committers":24,"mean_commits":14.25,"dds":0.1900584795321637,"last_synced_commit":"4fa48089b8b87a1ddbe43757958466d127c1fbef"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biter777%2Fcountries","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biter777%2Fcountries/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biter777%2Fcountries/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biter777%2Fcountries/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/biter777","download_url":"https://codeload.github.com/biter777/countries/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221504092,"owners_count":16833954,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["call-codes","cctld","currencies","currency","fifa","fips","go","ioc","iso","iso-3166","iso-3166-1","iso-3166-2","iso-4217","iso-639-1","iso3166","iso3166-1","iso3166-2","iso4217","json","money"],"created_at":"2024-07-30T20:01:58.090Z","updated_at":"2025-12-25T18:52:15.533Z","avatar_url":"https://github.com/biter777.png","language":"Go","readme":"# countries\r\n\r\nCountries - ISO 639, ISO 3166 (ISO3166-1, ISO3166, Digit, Alpha-2, Alpha-3) countries codes with subdivisions and names (on eng and rus), ISO4217 currency designators, ITU-T E.164 IDD calling phone codes, countries capitals, UN M.49 regions codes, IANA ccTLD countries domains, FIPS, IOC/NOC and FIFA codes, **VERY VERY FAST**, NO maps[], NO slices[], NO init() funcs, NO external links/files/data, NO interface{}, NO specific dependencies, compatible with Databases/JSON/BSON/GOB/XML/CSV, Emoji countries flags and currencies support, UN M.49, FIFA codes, full support ISO 639-1, ISO 3166-1, ISO 3166-2, ISO 4217, ITU-T E.164, Unicode CLDR and IANA ccTLD standarts.\r\n\r\n**Supported standarts:**\r\n   - ISO 639-1\r\n   - ISO 3166-1\r\n   - ISO 3166-2\r\n   - ISO 4217\r\n   - ICANN\r\n   - IANA ccTLD\r\n   - ITU-T E.164\r\n   - IOC\r\n   - NOC\r\n   - FIFA\r\n   - FIPS\r\n   - UN M.49\r\n   - Unicode CLDR \r\n   - Unicode Emoticons Flags\r\n   - Unicode Emoticons Currencies \r\n   - UN World Countries Capitals\r\n\r\n[![GoDev](https://img.shields.io/badge/godev-reference-5b77b3)](https://pkg.go.dev/github.com/biter777/countries?tab=doc)\r\n[![GoAwesome](https://img.shields.io/badge/awesome%20go-reference-5b77b3)](https://awesome-go.com/utilities/)\r\n[![Coder](https://img.shields.io/badge/coder-reference-5b77b3)](https://coder.social/biter777/countries)\r\n[![DOI](https://zenodo.org/badge/182808313.svg)](https://zenodo.org/badge/latestdoi/182808313)\r\n[![codeclimate](https://codeclimate.com/github/biter777/countries/badges/gpa.svg)](https://codeclimate.com/github/biter777/countries)\r\n[![GolangCI](https://golangci.com/badges/github.com/biter777/countries.svg?style=flat)](https://golangci.com/r/github.com/biter777/countries)\r\n[![GoReport](https://goreportcard.com/badge/github.com/biter777/countries)](https://goreportcard.com/report/github.com/biter777/countries)\r\n[![Codiga](https://img.shields.io/badge/codiga%20quality-A+-brightgreen)](https://app.codiga.io/project/3255/dashboard)\r\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/08eb1d2ff62e465091b3a288ae078a96)](https://www.codacy.com/manual/biter777/countries?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=biter777/countries\u0026amp;utm_campaign=Badge_Grade)\r\n[![codecov](https://codecov.io/gh/biter777/countries/branch/master/graph/badge.svg)](https://codecov.io/gh/biter777/countries)\r\n[![Coverage Status](https://coveralls.io/repos/github/biter777/countries/badge.svg?branch=master)](https://coveralls.io/github/biter777/countries?branch=master)\r\n[![Coverage](https://img.shields.io/badge/coverage-gocover.io-brightgreen)](https://gocover.io/github.com/biter777/countries)\r\n[![ISO](https://img.shields.io/badge/powered%20by-ISO-brightgreen)](https://www.iso.org/)\r\n[![ITU](https://img.shields.io/badge/powered%20by-ITU-brightgreen)](https://www.itu.int/)\r\n[![IANA](https://img.shields.io/badge/powered%20by-IANA-brightgreen)](http://www.iana.org/)\r\n[![ICANN](https://img.shields.io/badge/powered%20by-ICANN-brightgreen)](https://www.icann.org/)\r\n[![M49](https://img.shields.io/badge/powered%20by-UN%20M49-brightgreen)](https://unstats.un.org/unsd/methodology/m49/)\r\n[![CLDR](https://img.shields.io/badge/powered%20by-CLDR-brightgreen)](https://cldr.unicode.org/)\r\n[![License](https://img.shields.io/badge/License-BSD%202--Clause-brightgreen.svg)](https://opensource.org/licenses/BSD-2-Clause)\r\n[![Build status](https://ci.appveyor.com/api/projects/status/t9lpor9o8tpacpmr/branch/master?svg=true)](https://ci.appveyor.com/project/biter777/countries/branch/master)\r\n[![Build Status](https://github.com/biter777/countries/actions/workflows/go.yml/badge.svg)](https://github.com/biter777/countries/actions/workflows/go.yml)\r\n[![CLDR](https://img.shields.io/badge/deepsource-passing-brightgreen)]([https://cldr.unicode.org/](https://deepsource.io/gh/biter777/countries))\r\n\u003ca href=\"//www.dmca.com/Protection/Status.aspx?ID=7a019cc5-ec73-464b-9707-4b33726f348f\" title=\"DMCA.com Protection Status\" class=\"dmca-badge\"\u003e \u003cimg src =\"https://img.shields.io/badge/DMCA-protected-brightgreen\" alt=\"DMCA.com Protection Status\" /\u003e\u003c/a\u003e\r\n[![Dependencies Free](https://img.shields.io/badge/dependencies-free-brightgreen)](https://pkg.go.dev/github.com/biter777/countries?tab=imports)\r\n[![Gluten Free](https://img.shields.io/badge/gluten-free-brightgreen)](https://www.scsglobalservices.com/services/gluten-free-certification)\r\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen)](https://github.com/biter777/countries/pulls)\r\n[![DepShield Badge](https://depshield.sonatype.org/badges/biter777/countries/depshield.svg)](https://depshield.github.io)\r\n[![Stars](https://img.shields.io/github/stars/biter777/countries?label=Please%20like%20us\u0026style=social)](https://github.com/biter777/countries/stargazers)\r\n\u003cbr/\u003e\r\n\r\n## installation\r\n\r\n```shell\r\ngo get github.com/biter777/countries\r\n```\r\n\r\n## usage\r\n\r\n```go\r\ncountryJapan := countries.Japan\r\nfmt.Printf(\"Country name in english: %v\\n\", countryJapan)                   // Japan\r\nfmt.Printf(\"Country name in russian: %v\\n\", countryJapan.StringRus())       // Япония\r\nfmt.Printf(\"Country ISO-3166 digit code: %d\\n\", countryJapan)               // 392\r\nfmt.Printf(\"Country ISO-3166 Alpha-2 code: %v\\n\", countryJapan.Alpha2())    // JP\r\nfmt.Printf(\"Country ISO-3166 Alpha-3 code: %v\\n\", countryJapan.Alpha3())    // JPN\r\nfmt.Printf(\"Country IOC/NOC code: %v\\n\", countryJapan.IOC())                // JPN\r\nfmt.Printf(\"Country FIFA code: %v\\n\", countryJapan.FIFA())                  // JPN\r\nfmt.Printf(\"Country FIPS code: %v\\n\", countryJapan.FIPS())                  // JA\r\nfmt.Printf(\"Country Capital: %v\\n\", countryJapan.Capital())                 // Tokyo\r\nfmt.Printf(\"Country ITU-T E.164 call code: %v\\n\", countryJapan.CallCodes()) // +81\r\nfmt.Printf(\"Country ccTLD domain: %v\\n\", countryJapan.Domain())             // .jp\r\nfmt.Printf(\"Country UN M.49 region name: %v\\n\", countryJapan.Region())      // Asia\r\nfmt.Printf(\"Country UN M.49 region code: %d\\n\", countryJapan.Region())      // 142\r\nfmt.Printf(\"Country emoji/flag: %v\\n\", countryJapan.Emoji())                // 🇯🇵\r\nfmt.Printf(\"Country Subdivisions: %v\\n\", countryJapan.Subdivisions())       // Hokkaido Aomori Iwate Miyagi Akita Yamagata Fukushima Ibaraki Tochigi Gunma Saitama Chiba Tokyo Kanagawa Niigata Toyama Ishikawa Fukui Yamanashi Nagano Gifu Shizuoka Aichi Mie Shiga Kyoto Osaka Hyogo Nara Wakayama Tottori Shimane Okayama Hiroshima Yamaguchi Tokushima Kagawa Ehime Kochi Fukuoka Saga Nagasaki Kumamoto Oita Miyazaki Kagoshima Okinawa\r\n\r\ncurrencyJapan := countryJapan.Currency()\r\nfmt.Printf(\"Country ISO-4217 Currency name in english: %v\\n\", currencyJapan)           // Yen\r\nfmt.Printf(\"Country ISO-4217 Currency digit code: %d\\n\", currencyJapan)                // 392\r\nfmt.Printf(\"Country ISO-4217 Currency Alpha code: %v\\n\", currencyJapan.Alpha())        // JPY\r\nfmt.Printf(\"Country Currency emoji: %v\\n\", currencyJapan.Emoji())                      // 💴\r\nfmt.Printf(\"Country of Currency %v: %v\\n\\n\", currencyJapan, currencyJapan.Countries()) // Japan\r\n\r\n// OR you can alternative use:\r\njapanInfo := countries.Japan.Info()\r\nfmt.Printf(\"Country name in english: %v\\n\", japanInfo.Name)                          // Japan\r\nfmt.Printf(\"Country ISO-3166 digit code: %d\\n\", japanInfo.Code)                      // 392\r\nfmt.Printf(\"Country ISO-3166 Alpha-2 code: %v\\n\", japanInfo.Alpha2)                  // JP\r\nfmt.Printf(\"Country ISO-3166 Alpha-3 code: %v\\n\", japanInfo.Alpha3)                  // JPN\r\nfmt.Printf(\"Country IOC/NOC code: %v\\n\", japanInfo.IOC)                              // JPN\r\nfmt.Printf(\"Country FIFA code: %v\\n\", japanInfo.FIFA)                                // JPN\r\nfmt.Printf(\"Country FIPS code: %v\\n\", japanInfo.FIPS)                                // JA\r\nfmt.Printf(\"Country Capital: %v\\n\", japanInfo.Capital)                               // Tokyo\r\nfmt.Printf(\"Country ITU-T E.164 call code: %v\\n\", japanInfo.CallCodes)               // +81\r\nfmt.Printf(\"Country ccTLD domain: %v\\n\", japanInfo.Domain)                           // .jp\r\nfmt.Printf(\"Country UN M.49 region name: %v\\n\", japanInfo.Region)                    // Asia\r\nfmt.Printf(\"Country UN M.49 region code: %d\\n\", japanInfo.Region)                    // 142\r\nfmt.Printf(\"Country emoji/flag: %v\\n\", japanInfo.Emoji)                              // 🇯🇵\r\nfmt.Printf(\"Country ISO-4217 Currency name in english: %v\\n\", japanInfo.Currency)    // Yen\r\nfmt.Printf(\"Country ISO-4217 Currency digit code: %d\\n\", japanInfo.Currency)         // 392\r\nfmt.Printf(\"Country ISO-4217 Currency Alpha code: %v\\n\", japanInfo.Currency.Alpha()) // JPY\r\nfmt.Printf(\"Country Subdivisions: %v\\n\", japanInfo.Subdivisions)                     // Hokkaido Aomori Iwate Miyagi Akita Yamagata Fukushima Ibaraki Tochigi Gunma Saitama Chiba Tokyo Kanagawa Niigata Toyama Ishikawa Fukui Yamanashi Nagano Gifu Shizuoka Aichi Mie Shiga Kyoto Osaka Hyogo Nara Wakayama Tottori Shimane Okayama Hiroshima Yamaguchi Tokushima Kagawa Ehime Kochi Fukuoka Saga Nagasaki Kumamoto Oita Miyazaki Kagoshima Okinawa\r\n\r\n// Detection/Lookup usage\r\n// Detect/Lookup by country name\r\ncountry := countries.ByName(\"angola\")\r\nfmt.Printf(\"Country name in english: %v\\n\", country)                // Angola\r\nfmt.Printf(\"Country ISO-3166 digit code: %d\\n\", country)            // 24\r\nfmt.Printf(\"Country ISO-3166 Alpha-2 code: %v\\n\", country.Alpha2()) // AO\r\nfmt.Printf(\"Country ISO-3166 Alpha-3 code: %v\\n\", country.Alpha3()) // AGO\r\n// Detect/Lookup by country code\r\ncountry = countries.ByName(\"AO\")\r\nfmt.Printf(\"Country name in english: %v\\n\", country.String())       // Angola\r\nfmt.Printf(\"Country ISO-3166 digit code: %d\\n\", country)            // 24\r\nfmt.Printf(\"Country ISO-3166 Alpha-2 code: %v\\n\", country.Alpha2()) // AO\r\nfmt.Printf(\"Country ISO-3166 Alpha-3 code: %v\\n\", country.Alpha3()) // AGO\r\n// Detect/Lookup by code/numeric\r\ncountry = countries.ByNumeric(24)\r\nfmt.Printf(\"Country name in english: %v\\n\", country)                // Angola\r\nfmt.Printf(\"Country ISO-3166 digit code: %d\\n\", country)            // 24\r\nfmt.Printf(\"Country ISO-3166 Alpha-2 code: %v\\n\", country.Alpha2()) // AO\r\nfmt.Printf(\"Country ISO-3166 Alpha-3 code: %v\\n\", country.Alpha3()) // AGO\r\n\r\n// Comparing usage\r\n// Compare by code/numeric\r\nif countries.ByName(\"angola\") == countries.AGO {\r\n\tfmt.Println(\"Yes! It's Angola!\") // Yes! It's Angola!\r\n}\r\n// Compare by name\r\nif strings.EqualFold(\"angola\", countries.AGO.String()) {\r\n\tfmt.Println(\"Yes! It's Angola!\") // Yes! It's Angola!\r\n}\r\n\r\n// Database usage\r\ntype User struct {\r\n\tgorm.Model\r\n\tName     string\r\n\tCountry  countries.CountryCode\r\n\tCurrency countries.CurrencyCode\r\n}\r\nuser := \u0026User{Name: \"Helen\", Country: countries.Slovenia, Currency: countries.CurrencyEUR}\r\ndb, err := gorm.Open(\"postgres\", 500, \"host=127.0.0.2 port=5432 user=usr password=1234567 dbname=db\")\r\nif err != nil {\r\n\tpanic(err)\r\n}\r\ndefer db.Close()\r\ndb.Create(user)\r\n```\r\n\r\n## Options\r\n\r\nFor Emoji use Emoji(). Enjoy!\r\n\r\n```go\r\nimport \"github.com/biter777/countries\"\r\n```\r\n\r\nFor more complex options, consult the [documentation](http://godoc.org/github.com/biter777/countries).\r\n\r\n## Contributing\r\n\r\n1. **Welcome pull requests, bug fixes and issue reports**\r\n\r\n\t[Contributors list](https://github.com/biter777/countries/graphs/contributors)\r\n\t\r\n2. **Donate** - a donation isn't necessary, but it's welcome.\r\n\r\n\t\u003cnoscript\u003e\u003ca href=\"https://liberapay.com/biter777/donate\"\u003e\u003cimg alt=\"Donate using Liberapay\" src=\"https://liberapay.com/assets/widgets/donate.svg\"\u003e\u003c/a\u003e\u003c/noscript\u003e\r\n\t[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I61D1XZ) \u003ca href=\"https://pay.cloudtips.ru/p/94fc4268\" target=\"_blank\"\u003e\u003cimg height=\"30\" src=\"https://usa.visa.com/dam/VCOM/regional/lac/ENG/Default/Partner%20With%20Us/Payment%20Technology/visapos/full-color-800x450.jpg\"\u003e\u003c/a\u003e \u003ca href=\"https://pay.cloudtips.ru/p/94fc4268\" target=\"_blank\"\u003e\u003cimg height=\"30\" src=\"https://brand.mastercard.com/content/dam/mccom/brandcenter/thumbnails/mastercard_debit_sym_decal_web_105px.png\"\u003e\u003c/a\u003e \u003ca href=\"https://pay.cloudtips.ru/p/94fc4268\" target=\"_blank\"\u003e\u003cimg height=\"30\" src=\"https://developer.apple.com/assets/elements/icons/apple-pay/apple-pay.svg\"\u003e\u003c/a\u003e \u003ca href=\"https://pay.cloudtips.ru/p/94fc4268\" target=\"_blank\"\u003e\u003cimg height=\"30\" src=\"https://developers.google.com/pay/api/images/brand-guidelines/google-pay-mark.png\"\u003e\u003c/a\u003e \u003cbr/\u003e\r\n\r\n3. **Star us** - give us a star, please, if it's not against your religion :)\r\n\r\n\r\n\t[![Stars](https://img.shields.io/github/stars/biter777/countries?label=Please%20like%20us\u0026style=social)](https://github.com/biter777/countries/stargazers)\r\n\r\n## Updating ISO 3166\r\n\r\nMaking use of changes to the [iso-codes](https://salsa.debian.org/iso-codes-team/iso-codes) project.\r\n\r\n**TODO** create go generate capability to automatically generate from the json files\r\nin the [data](https://salsa.debian.org/iso-codes-team/iso-codes/-/tree/main/data/)\r\ndirectory of the iso-codes project.\r\n","funding_links":["https://liberapay.com/biter777","https://ko-fi.com/biter777","https://funding.communitybridge.org/projects/countries","https://www.buymeacoffee.com/CAhuDKg","https://pay.cloudtips.ru/p/94fc4268","https://liberapay.com/biter777/donate","https://ko-fi.com/I2I61D1XZ"],"categories":["Utilities","公用事业公司","Repositories","工具库","Utility","工具库`可以提升效率的通用代码库和工具`"],"sub_categories":["Utility/Miscellaneous","HTTP Clients","Fail injection","实用程序/Miscellaneous","查询语"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiter777%2Fcountries","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiter777%2Fcountries","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiter777%2Fcountries/lists"}