Skip to content

ramadani/adminarea-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

adminarea-cli

Administrative Area CLI

Features

  • Create db table
  • Save a country
  • Save the provinces of a country
  • Save the cities/regencies of a country
  • Save the districts of a country
  • Save the villages of a country

Available Countries

  • Indonesia (id)

Installation

To install the library and command line program, use the following:

go get -v github.com/ramadani/adminarea-cli/...

Usage

Create adminarea_config.yml and fill it with following this values:

db:
  driver: mysql
  dsn: user:password@tcp(127.0.0.1:3306)/dbname?parseTime=true

Available Commands

setup     Create administrative areas table
country   Save a country     province  Save the provinces of a country
city      Save the cities/regencies of a country
district  Save the districts of a country
village   Save the villages of a country

Create DB table

To create administrative_areas table to your database, run this command:

adminarea-cli setup

Save the country

// adminarea-cli country [COUNTRY_CODE_ID]
adminarea-cli country id

Save the provinces of a country

// adminarea-cli province [COUNTRY_CODE_ID]
adminarea-cli province id

Save the cities/regencies of a country

// adminarea-cli city [COUNTRY_CODE_ID]
adminarea-cli city id

Save the districts of a country

// adminarea-cli district [COUNTRY_CODE_ID]
adminarea-cli district id

Save the villages of a country

// adminarea-cli village [COUNTRY_CODE_ID]
adminarea-cli village id

TODO

  • Can create db table
  • Config file can pass by argument
  • Save a country
  • Save provinces by country
  • Save regencies by country
  • Save districts by country
  • Save villages by country

References

License

This library is distributed under the MIT license.