bug fixed
This commit is contained in:
parent
3604f1a593
commit
1d0ca7b116
3
mysql.go
3
mysql.go
|
@ -179,7 +179,8 @@ func (db *mysql) GetColumns(tableName string) (map[string]*Column, error) {
|
||||||
cts := strings.Split(string(content), "(")
|
cts := strings.Split(string(content), "(")
|
||||||
var len1, len2 int
|
var len1, len2 int
|
||||||
if len(cts) == 2 {
|
if len(cts) == 2 {
|
||||||
lens := strings.Split(cts[1][0:len(cts[1])-1], ",")
|
idx := strings.Index(cts[1], ")")
|
||||||
|
lens := strings.Split(cts[1][0:idx], ",")
|
||||||
len1, err = strconv.Atoi(strings.TrimSpace(lens[0]))
|
len1, err = strconv.Atoi(strings.TrimSpace(lens[0]))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
# xorm tools
|
||||||
|
|
||||||
|
|
||||||
|
xorm tools is a set of tools for database operation.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
`go get github.com/lunny/xorm/xorm`
|
||||||
|
|
||||||
|
and you should install the depends below:
|
||||||
|
|
||||||
|
* github.com/lunny/xorm
|
||||||
|
|
||||||
|
* Mysql: [github.com/Go-SQL-Driver/MySQL](https://github.com/Go-SQL-Driver/MySQL)
|
||||||
|
|
||||||
|
* MyMysql: [github.com/ziutek/mymysql/godrv](https://github.com/ziutek/mymysql/godrv)
|
||||||
|
|
||||||
|
* SQLite: [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3)
|
||||||
|
|
||||||
|
* Postgres: [github.com/bylevel/pq](https://github.com/bylevel/pq)
|
||||||
|
|
||||||
|
|
||||||
|
## Reverse
|
||||||
|
|
||||||
|
After you installed the tool, you can type
|
||||||
|
|
||||||
|
`xorm help reverse`
|
||||||
|
|
||||||
|
to get help
|
||||||
|
|
||||||
|
example:
|
||||||
|
|
||||||
|
`xorm reverse sqite3 test.db templates/goxorm`
|
||||||
|
|
||||||
|
will generated go files in `./model` directory
|
||||||
|
|
||||||
|
## LICENSE
|
||||||
|
|
||||||
|
BSD License
|
||||||
|
[http://creativecommons.org/licenses/BSD/](http://creativecommons.org/licenses/BSD/)
|
|
@ -56,7 +56,7 @@ func runReverse(cmd *Command, args []string) {
|
||||||
args = args[num:]
|
args = args[num:]
|
||||||
|
|
||||||
if len(args) < 3 {
|
if len(args) < 3 {
|
||||||
fmt.Println("no")
|
fmt.Println("params error, please see xorm help reverse")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue