{"id":21478070,"url":"https://github.com/ichtrojan/go-location","last_synced_at":"2025-07-15T10:33:52.966Z","repository":{"id":56164292,"uuid":"211333968","full_name":"ichtrojan/go-location","owner":"ichtrojan","description":"A simple Go Package to sort Countries, States and Cities ","archived":false,"fork":false,"pushed_at":"2020-01-13T18:04:03.000Z","size":1964,"stargazers_count":43,"open_issues_count":0,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T08:18:53.438Z","etag":null,"topics":["go","golang","location","package"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ichtrojan.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-27T14:10:34.000Z","updated_at":"2023-09-07T00:09:15.000Z","dependencies_parsed_at":"2022-08-15T13:50:57.099Z","dependency_job_id":null,"html_url":"https://github.com/ichtrojan/go-location","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ichtrojan%2Fgo-location","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ichtrojan%2Fgo-location/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ichtrojan%2Fgo-location/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ichtrojan%2Fgo-location/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ichtrojan","download_url":"https://codeload.github.com/ichtrojan/go-location/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226033200,"owners_count":17563126,"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":["go","golang","location","package"],"created_at":"2024-11-23T11:16:27.544Z","updated_at":"2024-11-23T11:16:29.836Z","avatar_url":"https://github.com/ichtrojan.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go Location ▲\n\n![banner](https://res.cloudinary.com/ichtrojan/image/upload/v1573518254/Screenshot_2019-11-12_at_01.18.23_ioaynx.png)\n\n## Introduction 🖖\n\nThis Package offers a simple way to get Countries, Cities and States that you may need for your Application, most especially for location dropdown.\n\n## Getting Started 💽\n\n### Install Package\n\nInstall this Package by running:\n\n```bash\ngo get github.com/ichtrojan/go-location\n```\n\n### Import Package\n\n```go\nimport \"github.com/ichtrojan/go-location\"\n```\n\n## Usage 🧨\n\nThis package will return the output in `structs`, you can manipulate the output however you choose. You can check the `main.go` file located in the `example` directory, the sample code in there returns the output as `JSON` to the web.\n\n### Demo\n\n* Clone this repo: `git clone github.com/ichtrojan/go-location`\n* Change directory to example folder: `cd go-location/example`\n* Run the application: `go run main.go`\n* Visit application:\n\n|Endpoint|Description|\n|:------------- | :----------: |\n|`/country`|return all countries|\n|`/country/{id}`|return a single country by its ID|\n|`/state`|return all states|\n|`/state/{id}`|return a single state by its ID|\n|`/states/{countryID}`|return all states in a country using the country ID|\n|`/city`|return all cities|\n|`/city/{id}`|return a single city by its ID|\n|`/cities`|return all cities in a state using the state ID|\n\n### Package Methods\n\n#### Get all countries\n\n````go\ngolocation.AllCountries()\n````\n\n#### Get a Country\n\n```go\ngolocation.GetCountry(id)\n```\n\n\u003e **NOTE**\u003c/br\u003e\n\u003e`id` refers to the country ID\n\n#### Get all states\n\n```go\ngolocation.AllStates()\n```\n\n#### Get a state\n\n```go\ngolocation.GetState(id)\n```\n\n\u003e **NOTE**\u003c/br\u003e\n\u003e`id` refers to the state ID\n\n#### Get all states in a country\n\n```go\ngolocation.GetCountryStates(id)\n```\n\n\u003e **NOTE**\u003c/br\u003e\n\u003e`id` refers to the country ID\n\n#### Get all cities\n\n```get\ngolocation.GetCities()\n```\n\n#### Get a city\n\n```go\ngolocation.GetCity(id)\n```\n\n\u003e **NOTE**\u003c/br\u003e\n\u003e`id` refers to the city ID\n\n#### Get cities in a state\n\n```go\ngolocation.GetStateCites(id)\n```\n\n\u003e **NOTE**\u003c/br\u003e\n\u003e`id` refers to the state ID\n\n## Contribution\n\nFree for all, if you find an issue with the package or if a group of people somehow created a new country please send in a PR.\n\nDanke Schön \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fichtrojan%2Fgo-location","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fichtrojan%2Fgo-location","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fichtrojan%2Fgo-location/lists"}