https://github.com/zhoutk/gotools
create some tools use go lang.
https://github.com/zhoutk/gotools
golang goroutine mysql spider tools
Last synced: 3 months ago
JSON representation
create some tools use go lang.
- Host: GitHub
- URL: https://github.com/zhoutk/gotools
- Owner: zhoutk
- License: mit
- Created: 2018-06-11T22:38:57.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-01-21T09:28:02.000Z (about 7 years ago)
- Last Synced: 2024-06-20T11:59:28.678Z (almost 2 years ago)
- Topics: golang, goroutine, mysql, spider, tools
- Language: Go
- Size: 79.1 KB
- Stars: 75
- Watchers: 2
- Forks: 23
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# goTools
> create some tools use go lang.
1. mysql exporter
2. ip spider
## 1. mysql exporter
a tool can export mysql's table,data,views,function & stored procedure together or independent.
### characteristic
- can export table, data, views, funcs.
- multi grountinue to export many database together.
- filter \xfffd.
- solve the dependence of views.
- can recieve a cli arg, which must be in table, data, view(s) & func, to export single content.
### configs.json
you must create configs.json as:
```
{
"db_name1": {
"db_host": "192.168.1.8",
"db_port": 3306,
"db_user": "root",
"db_pass": "123456",
"db_name": "name1",
"db_charset": "utf8mb4",
"file_alias": "file name1"
},
"db_name2": {
"db_host": "localhost",
"db_port": 3306,
"db_user": "root",
"db_pass": "123456",
"db_name": "name2",
"db_charset": "utf8mb4"
},
"database_dialect": "mysql",
"workDir": "/home/zhoutk/gocodes/goTools/"
}
```
### Instructions
```
git clone https://github.com/zhoutk/goTools
cd goTools
go get
go run main.go
go buid main.go
./main #export all things of database
./main table #export tables
./main data #export tables & data
./main views #export views
./main funcs #export funcs & stored procedures
```
## 2. ip spider
a tool can spider ip address info from appointed web page.
### characteristic
- multi grountinue to spider web data.
- write mysql batch.
- update mysql batch.
### sql scripts
you can create table use it:
```
CREATE TABLE `ip_addr_info` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '索引,自动增长',
`ip_addr_begin` varchar(32) NOT NULL DEFAULT '' COMMENT 'ip地址段开始',
`ip_addr_end` varchar(32) DEFAULT '' COMMENT 'ip地址段结束',
`province` varchar(32) DEFAULT '' COMMENT '所属省',
`ip_comp` varchar(32) DEFAULT '' COMMENT '运营商',
PRIMARY KEY (`id`),
UNIQUE KEY `ip_addr` (`ip_addr_begin`,`ip_addr_end`)
) ENGINE=InnoDB AUTO_INCREMENT=7268 DEFAULT CHARSET=utf8 COMMENT='表';
```
### Instructions
```
git clone https://github.com/zhoutk/goTools
cd goTools
go get
go run ip.go
go buid ip.go
./ip
```
## 3. rest server
A framework for building micro service rapidly, safely & efficiently.
### characteristic
- auto orm that can build sql from json object.
- standard sql interface.
- auto restful api serivce according to sql struct.
### Instructions
```
git clone https://github.com/zhoutk/goTools
cd goTools
go get
go run bock.go
go buid bock.go
./bock
```