1

go-city

演示

go-city sync --dbname=webcron --driver=database --table=city
100% |█████████████████████████████████████████| (34/34, 2 it/min)
time="2023-03-04T10:29:26+08:00" level=info msg="数据同步完成,其中省级行政区:34,城市:452,区县:5234,乡镇街道:43564"

install

go install https://github.com/xiaoxuan6/go-city.git

Usage

Sqilte

go-city sync --db=./sqlite.db

Database

go-city sync --driver=database --host=127.0.0.1 --port=3306 --username=root --password=root --dbname=city --table=city

More

NAME:
 go-city sync
USAGE:
 go-city sync [command options] [arguments...]
DESCRIPTION:
  同步省市区到数据库

OPTIONS:
   --driver value, -d value  db driver,Support:sqlite、database、memory (default: "sqlite") [%GO_CITY_DRIVER%]
   --db value                database file (default: "./sqlite.db") [%GO_CITY_DB%]
   --host value              database host (default: "127.0.0.1") [%GO_CITY_DB_HOST%]
   --port value              database port (default: "3306") [%GO_CITY_DB_PORT%]
   --username value          database username (default: "root") [%GO_CITY_DB_USERNAME%]
   --password value          database password (default: "root") [%GO_CITY_DB_PASSWORD%]
   --dbname value            database dbname [%GO_CITY_DB_NAME%]
   --table value             database table name (default: "cities") [%GO_CITY_DB_TABLE_NAME%]
   --help, -h                show help

xiaoxuan6
29 声望0 粉丝