improved docs

This commit is contained in:
Lunny Xiao 2013-11-22 09:20:41 +08:00
parent ec13aa9bab
commit 65d079fc2c
4 changed files with 78 additions and 56 deletions

15
Changelog.md Normal file
View File

@ -0,0 +1,15 @@
## Changelog
* **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.
* **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;
* **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.

View File

@ -1,16 +1,28 @@
# xorm
[中文](https://github.com/lunny/xorm/blob/master/README_CN.md) [中文](https://github.com/lunny/xorm/blob/master/README_CN.md)
Xorm is a simple and powerful ORM for Go. It makes dabatabse operating simple. Xorm is a simple and powerful ORM for Go.
[![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") [![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")
## Discuss # Features
Please visit [xorm on Google Groups](https://groups.google.com/forum/#!forum/xorm) * Struct <-> Table Mapping Support
## Drivers Support * Chainable APIs
* Transaction Support
* Both ORM and raw SQL Operation Support
* Sync database sechmea Support
* Query Cache speed up read
* Database Reverse support, See [Xorm Tool README](https://github.com/lunny/xorm/blob/master/xorm/README.md)
* Simple cascade loading support
# Drivers Support
Drivers for Go's sql package which currently support database/sql includes: Drivers for Go's sql package which currently support database/sql includes:
@ -25,54 +37,28 @@ Drivers for Go's sql package which currently support database/sql includes:
* Postgres: [github.com/bylevel/pq](https://github.com/bylevel/pq) * Postgres: [github.com/bylevel/pq](https://github.com/bylevel/pq)
## Changelog # Changelog
* **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.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. * **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.
* **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; * **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;
* **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 [More changelog ...](https://github.com/lunny/xorm/blob/master/Changelog.md)
* Struct<->Table Mapping Supports, both name mapping and filed tag mapping
* Database Transaction Support
* Both ORM and SQL Operation Support
* Simply chainable usage
* Support Id, In, Where, Limit, Join, Having, Sql functions and sturct as query conditions
* Cache Support
* Simple cascade load support
* Database Reverse Tool support, See [Xorm Tool README](https://github.com/lunny/xorm/blob/master/xorm/README.md)
## Installing xorm # Installation
go get github.com/lunny/xorm go get github.com/lunny/xorm
## Documents # Documents
[Quick Start](https://github.com/lunny/xorm/blob/master/docs/QuickStartEn.md) * [Quick Start](https://github.com/lunny/xorm/blob/master/docs/QuickStartEn.md)
[GoDoc](http://godoc.org/github.com/lunny/xorm) * [GoDoc](http://godoc.org/github.com/lunny/xorm)
[GoWalker](http://gowalker.org/github.com/lunny/xorm) * [GoWalker](http://gowalker.org/github.com/lunny/xorm)
## Cases # Cases
* [Gowalker](http://gowalker.org) - [github.com/Unknwon/gowalker](http://github.com/Unknwon/gowalker) * [Gowalker](http://gowalker.org) - [github.com/Unknwon/gowalker](http://github.com/Unknwon/gowalker)
@ -82,19 +68,11 @@ Drivers for Go's sql package which currently support database/sql includes:
* [Very Hour](http://veryhour.com/) * [Very Hour](http://veryhour.com/)
## FAQ # Discuss
1.How the xorm tag use both with json? Please visit [Xorm on Google Groups](https://groups.google.com/forum/#!forum/xorm)
Use space. # LICENSE
```Go
type User struct {
Name string `json:"name" xorm:"name"`
}
```
## LICENSE
BSD License BSD License
[http://creativecommons.org/licenses/BSD/](http://creativecommons.org/licenses/BSD/) [http://creativecommons.org/licenses/BSD/](http://creativecommons.org/licenses/BSD/)

19
doc.go
View File

@ -2,6 +2,21 @@
// Use of this source code is governed by a BSD // Use of this source code is governed by a BSD
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// Package xorm is a simple and powerful ORM for Go. It makes /*
// database operation simple. Package xorm is a simple and powerful ORM for Go. It makes
database operation simple.
First, we should new a engine for a database
engine, err = xorm.NewEngine(driverName, dataSourceName)
Method NewEngine's parameters is the same as sql.Open. It depends
drivers' implementation. Generally, one engine is enough.
engine.Get(...)
engine.Insert(...)
engine.Find(...)
engine.Iterate(...)
engine.Delete(...)
*/
package xorm package xorm

View File

@ -15,6 +15,7 @@ Quick Start
* [11.Execute SQL](#110) * [11.Execute SQL](#110)
* [12.Advanced Usage](#120) * [12.Advanced Usage](#120)
* [13.Mapping Rules](#130) * [13.Mapping Rules](#130)
* [14.FAQ](#140)
<a name="10" id="10"></a> <a name="10" id="10"></a>
## 1.Create database engine ## 1.Create database engine
@ -401,3 +402,16 @@ for i := 0; i < 10; i++ {
user := Userinfo{Uid: 25, Username:"sslfs"} user := Userinfo{Uid: 25, Username:"sslfs"}
engine.Table(fmt.Sprintf("user_%v", user.Uid % 10)).Insert(&user) engine.Table(fmt.Sprintf("user_%v", user.Uid % 10)).Insert(&user)
``` ```
<a name="140"></a>
## 14.FAQ
1.How the xorm tag use both with json?
Use space.
```Go
type User struct {
Name string `json:"name" xorm:"name"`
}
```