2014-01-07 09:21:02 +00:00
# xorm tools
xorm tools is a set of tools for database operation.
## Install
2014-04-11 09:16:43 +00:00
`go get github.com/go-xorm/xorm/xorm`
2013-10-14 08:33:07 +00:00
and you should install the depends below:
2014-04-11 09:16:43 +00:00
* github.com/go-xorm/xorm
2014-01-07 09:21:02 +00:00
* 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 )
2013-10-14 08:33:07 +00:00
* Postgres: [github.com/bylevel/pq ](https://github.com/bylevel/pq )
2014-01-07 09:21:02 +00:00
## Reverse
2013-10-14 08:33:07 +00:00
After you installed the tool, you can type
2014-01-07 09:21:02 +00:00
`xorm help reverse`
2013-10-14 08:33:07 +00:00
to get help
example:
2013-10-20 02:43:49 +00:00
sqlite:
2013-10-14 08:33:07 +00:00
`xorm reverse sqite3 test.db templates/goxorm`
2013-10-20 02:43:49 +00:00
mysql:
`xorm reverse mysql root:@/xorm_test?charset=utf8 templates/goxorm`
mymysql:
`xorm reverse mymysql xorm_test2/root/ templates/goxorm`
postgres:
`xorm reverse postgres "dbname=xorm_test sslmode=disable" templates/goxorm`
2013-10-14 09:46:04 +00:00
will generated go files in `./model` directory
## Template and Config
2013-10-14 09:51:45 +00:00
Now, xorm tool supports go and c++ two languages and have go, goxorm, c++ three of default templates. In template directory, we can put a config file to control how to generating.
````
lang=go
2014-01-07 09:21:02 +00:00
genJson=1
2013-10-14 09:51:45 +00:00
```
lang must be go or c++ now.
genJson can be 1 or 0, if 1 then the struct will have json tag.
2014-01-07 09:21:02 +00:00
## LICENSE
BSD License
[http://creativecommons.org/licenses/BSD/ ](http://creativecommons.org/licenses/BSD/ )