-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of githubjason.com:verytalk/export-select-to-in…
…sert-golang
- Loading branch information
Showing
1 changed file
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,64 @@ | ||
# export-select-to-insert-golang | ||
|
||
|
||
go run main.go config test.yaml | ||
#### How to use | ||
|
||
go build main.go | ||
> clone project | ||
``` | ||
git@github.com:verytalk/export-select-to-insert-golang.git | ||
``` | ||
|
||
|
||
> Linux | ||
- edit config file config.yaml | ||
- running the file main For example: | ||
|
||
``` | ||
./main | ||
``` | ||
|
||
> Other execution ways | ||
- Install golang environment | ||
- running script main.go For example | ||
|
||
``` | ||
go run main.go | ||
``` | ||
|
||
|
||
> If you don't want to use the default config file config.yaml | ||
``` | ||
./main --config test.yaml | ||
or | ||
go run main.go --config test.yaml | ||
``` | ||
|
||
> Explain config file | ||
``` | ||
mysql: | ||
user : root # mysql user | ||
password : root # mysql password | ||
host : 127.0.0.1 # mysql host | ||
port : 3306 # mysql port | ||
name : test # mysql database name | ||
logfile: | ||
filename: Logs.sql # export SQL to the filename | ||
export: | ||
tableName: Logs # generate insert to table | ||
exportSQL: SELECT * FROM Logs # SELECT statement | ||
exportOpenPaging: true # using paging true/false | ||
exportPagingStart: 0 # start page | ||
exportPagingEnd: 400 # end page | ||
exportPagingLimit: 20000 # length per page | ||
``` | ||
|
||
GO111MODULE=on go run main.go -config test.yaml | ||
|
||
|