xorm/README.md

101 lines
4.2 KiB
Markdown
Raw Normal View History

2013-05-06 08:01:17 +00:00
# xorm
2013-05-03 07:26:51 +00:00
2013-05-12 05:43:09 +00:00
[中文](https://github.com/lunny/xorm/blob/master/README_CN.md)
2013-05-03 07:26:51 +00:00
Xorm is a simple and powerful ORM for Go. It makes dabatabse operating simple.
2013-08-16 04:22:34 +00:00
2013-10-09 07:08:52 +00:00
[![Build Status](https://drone.io/github.com/lunny/xorm/status.png)](https://drone.io/github.com/lunny/xorm/latest) [![Go Walker](http://gowalker.org/api/v1/badge)](http://gowalker.org/github.com/lunny/xorm) [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/lunny/xorm/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
2013-09-11 08:30:17 +00:00
2013-09-29 14:39:59 +00:00
## Discuss
Please visit [xorm on Google Groups](https://groups.google.com/forum/#!forum/xorm)
2013-08-16 04:22:34 +00:00
2013-05-11 10:38:43 +00:00
## Drivers Support
2013-08-16 04:22:34 +00:00
2013-05-11 10:38:43 +00:00
Drivers for Go's sql package which currently support database/sql includes:
2013-05-03 07:26:51 +00:00
2013-10-18 12:41:30 +00:00
* Mysql: [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)
2013-05-03 07:26:51 +00:00
2013-08-16 04:22:34 +00:00
* 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-11-06 07:43:30 +00:00
* Postgres: [github.com/lib/pq](https://github.com/lib/pq)
2013-08-16 04:23:36 +00:00
* Postgres: [github.com/bylevel/pq](https://github.com/bylevel/pq)
2013-08-16 04:22:34 +00:00
## Changelog
2013-11-06 07:54:42 +00:00
* **v0.2.2** : Postgres drivers now support lib/pq; Added method Iterate for record by record to handlerAdded SetMaxConns(go1.2+) support; some bugs fixed.
* **v0.2.1** : Added database reverse tool, now support generate go & c++ codes, see [Xorm Tool README](https://github.com/lunny/xorm/blob/master/xorm/README.md); some bug fixed.
2013-09-29 08:53:01 +00:00
* **v0.2.0** : Added Cache supported, select is speeder up 3~5x; Added SameMapper for same name between struct and table; Added Sync method for auto added tables, columns, indexes;
2013-08-16 04:22:34 +00:00
* **v0.1.9** : Added postgres and mymysql supported; Added ` and ? supported on Raw SQL even if postgres; Added Cols, StoreEngine, Charset function, Added many column data type supported, please see [Mapping Rules](#mapping).
* **v0.1.8** : Added union index and union unique supported, please see [Mapping Rules](#mapping).
* **v0.1.7** : Added IConnectPool interface and NoneConnectPool, SysConnectPool, SimpleConnectPool the three implements. You can choose one of them and the default is SysConnectPool. You can customrize your own connection pool. struct Engine added Close method, It should be invoked before system exit.
* **v0.1.6** : Added conversion interface support; added struct derive support; added single mapping support
* **v0.1.5** : Added multi threads support; added Sql() function for struct query; Get function changed return inteface; MakeSession and Create are instead with NewSession and NewEngine.
* **v0.1.4** : Added simple cascade load support; added more data type supports.
* **v0.1.3** : Find function now supports both slice and map; Add Table function for multi tables and temperory tables support
* **v0.1.2** : Insert function now supports both struct and slice pointer parameters, batch inserting and auto transaction
* **v0.1.1** : Add Id, In functions and improved README
* **v0.1.0** : Inital release.
## Features
* Struct<->Table Mapping Supports, both name mapping and filed tag mapping
2013-08-16 04:22:34 +00:00
* Database Transaction Support
2013-08-16 04:22:34 +00:00
* Both ORM and SQL Operation Support
2013-08-16 04:22:34 +00:00
* Simply chainable usage
2013-08-16 04:22:34 +00:00
* Support Id, In, Where, Limit, Join, Having, Sql functions and sturct as query conditions
* Cache Support
2013-08-16 04:22:34 +00:00
* Simple cascade load support
* Database Reverse Tool support, See [Xorm Tool README](https://github.com/lunny/xorm/blob/master/xorm/README.md)
2013-05-03 07:26:51 +00:00
2013-08-16 04:22:34 +00:00
## Installing xorm
2013-05-06 08:01:17 +00:00
go get github.com/lunny/xorm
2013-05-03 07:26:51 +00:00
## Documents
[Quick Start](https://github.com/lunny/xorm/blob/master/docs/QuickStartEn.md)
[GoDoc](http://godoc.org/github.com/lunny/xorm)
2013-08-16 04:22:34 +00:00
[GoWalker](http://gowalker.org/github.com/lunny/xorm)
## Cases
2013-11-15 03:04:48 +00:00
* [Gowalker](http://gowalker.org) - [github.com/Unknwon/gowalker](http://github.com/Unknwon/gowalker)
* [Sudo China](http://sudochina.com) - [github.com/insionng/toropress](http://github.com/insionng/toropress)
* [Godaily](http://godaily.org) - [github.com/govc/godaily](http://github.com/govc/godaily)
* [Very Hour](http://veryhour.com/)
2013-08-16 04:22:34 +00:00
## FAQ
1.How the xorm tag use both with json?
Use space.
```Go
type User struct {
Name string `json:"name" xorm:"name"`
}
```
2013-05-03 07:26:51 +00:00
## LICENSE
BSD License
[http://creativecommons.org/licenses/BSD/](http://creativecommons.org/licenses/BSD/)