Skip to content

Commit 70a9087

Browse files
author
root
committed
增加使用说明
1 parent 492b484 commit 70a9087

File tree

4 files changed

+12
-42
lines changed

4 files changed

+12
-42
lines changed

.gitignore

100644100755
+2-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ _testmain.go
2222
*.exe
2323
*.test
2424

25-
gorm-tool
25+
gorm
26+
models

README.md

100644100755
+1-16
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,6 @@ gorm tools is a set of tools for database operation.
99

1010
`git clone https://github.com/liangyt123/gorm`
1111

12-
and you should install the depends below:
13-
14-
* github.com/go-xorm/xorm
15-
16-
* Mysql: [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)
17-
18-
* MyMysql: [github.com/ziutek/mymysql/godrv](https://github.com/ziutek/mymysql/godrv)
19-
20-
* Postgres: [github.com/lib/pq](https://github.com/lib/pq)
21-
22-
* SQLite: [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3)
23-
24-
* MSSQL: [github.com/denisenkom/go-mssqldb](https://github.com/denisenkom/go-mssqldb)
25-
26-
** For sqlite support, you need build via `go build -tags sqlite3` because of this driver ask cgo.
2712

2813
## Commands
2914

@@ -51,7 +36,7 @@ sqlite:
5136
`gorm reverse sqite3 test.db templates/gogorm`
5237

5338
mysql:
54-
`gorm reverse mysql root:@/gorm_test?charset=utf8 templates/gogorm`
39+
`gorm reverse mysql 'root:123456@tcp(127.0.0.1:3306)/gorm_test'?charset=utf8 templates/gogorm`
5540

5641
mymysql:
5742
`gorm reverse mymysql gorm_test2/root/ templates/gogorm`

README_CN.md

100644100755
+7-23
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,6 @@ gorm 是一组数据库操作命令行工具。
88

99
`git clone https://github.com/liangyt123/gorm`
1010

11-
同时你需要安装如下依赖:
12-
13-
* github.com/go-xorm/xorm
14-
15-
* Mysql: [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)
16-
17-
* MyMysql: [github.com/ziutek/mymysql/godrv](https://github.com/ziutek/mymysql/godrv)
18-
19-
* Postgres: [github.com/lib/pq](https://github.com/lib/pq)
20-
21-
* SQLite: [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3)
22-
23-
* MSSQL: [github.com/denisenkom/go-mssqldb](https://github.com/denisenkom/go-mssqldb)
24-
25-
** 对于sqlite3的支持,你需要自己进行编译 `go build -tags sqlite3` 因为sqlite3需要cgo的支持。
26-
2711
## 命令列表
2812

2913
有如下可用的命令:
@@ -52,13 +36,13 @@ sqlite:
5236
`gorm reverse sqite3 test.db templates/gogorm`
5337

5438
mysql:
55-
`xorm reverse mysql root:@/xorm_test?charset=utf8 templates/goxorm`
39+
`gorm reverse mysql 'root:123456@tcp(127.0.0.1:3306)/gorm_test'?charset=utf8 templates/gogorm`
5640

5741
mymysql:
58-
`xorm reverse mymysql xorm_test2/root/ templates/goxorm`
42+
`gorm reverse mymysql gorm_test2/root/ templates/gogorm`
5943

6044
postgres:
61-
`xorm reverse postgres "dbname=xorm_test sslmode=disable" templates/goxorm`
45+
`gorm reverse postgres "dbname=gorm_test sslmode=disable" templates/gogorm`
6246

6347
之后将会生成代码 generated go files in `./model` directory
6448

@@ -78,18 +62,18 @@ genJson=1
7862

7963
Shell command provides a tool to operate database. For example, you can create table, alter table, insert data, delete data and etc.
8064

81-
`xorm shell sqlite3 test.db` will connect to the sqlite3 database and you can type `help` to list all the shell commands.
65+
`gorm shell sqlite3 test.db` will connect to the sqlite3 database and you can type `help` to list all the shell commands.
8266

8367
## Dump
8468

8569
Dump command provides a tool to dump all database structs and data as SQL to your standard output.
8670

87-
`xorm dump sqlite3 test.db` could dump sqlite3 database test.db to standard output. If you want to save to file, just
88-
type `xorm dump sqlite3 test.db > test.sql`.
71+
`gorm dump sqlite3 test.db` could dump sqlite3 database test.db to standard output. If you want to save to file, just
72+
type `gorm dump sqlite3 test.db > test.sql`.
8973

9074
## Source
9175

92-
`xorm source sqlite3 test.db < test.sql` will execute sql file on the test.db.
76+
`gorm source sqlite3 test.db < test.sql` will execute sql file on the test.db.
9377

9478
## Driver
9579

win-build.bat

100644100755
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@echo off
2-
del .\gorm-tool
2+
del gorm.exe
33
set GOARCH=amd64
44
set GOOS=linux
5-
go build -o gorm
5+
go build -o gorm.exe

0 commit comments

Comments
 (0)