From 65d079fc2c683bf45f2b9c6b82b32e25b7178d7b Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 22 Nov 2013 09:20:41 +0800 Subject: [PATCH] improved docs --- Changelog.md | 15 ++++++++ README.md | 84 ++++++++++++++++---------------------------- doc.go | 19 ++++++++-- docs/QuickStartEn.md | 16 ++++++++- 4 files changed, 78 insertions(+), 56 deletions(-) create mode 100644 Changelog.md diff --git a/Changelog.md b/Changelog.md new file mode 100644 index 00000000..b221c4a9 --- /dev/null +++ b/Changelog.md @@ -0,0 +1,15 @@ +## Changelog + +* **v0.2.2** : Postgres drivers now support lib/pq; Added method Iterate for record by record to handler;Added 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. \ No newline at end of file diff --git a/README.md b/README.md index b93e7e78..b3caea36 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,28 @@ -# xorm - [中文](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") - -## Discuss -Please visit [xorm on Google Groups](https://groups.google.com/forum/#!forum/xorm) +# Features -## Drivers Support +* Struct <-> Table Mapping 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: @@ -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) -## Changelog +# Changelog * **v0.2.2** : Postgres drivers now support lib/pq; Added method Iterate for record by record to handler;Added 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. - -## Features - -* 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) +[More changelog ...](https://github.com/lunny/xorm/blob/master/Changelog.md) -## Installing xorm +# Installation 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) @@ -82,19 +68,11 @@ Drivers for Go's sql package which currently support database/sql includes: * [Very Hour](http://veryhour.com/) -## FAQ +# Discuss + +Please visit [Xorm on Google Groups](https://groups.google.com/forum/#!forum/xorm) -1.How the xorm tag use both with json? - - Use space. - -```Go -type User struct { - Name string `json:"name" xorm:"name"` -} -``` - -## LICENSE +# LICENSE BSD License [http://creativecommons.org/licenses/BSD/](http://creativecommons.org/licenses/BSD/) diff --git a/doc.go b/doc.go index 4d499f1c..371f4b31 100644 --- a/doc.go +++ b/doc.go @@ -2,6 +2,21 @@ // Use of this source code is governed by a BSD // 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 diff --git a/docs/QuickStartEn.md b/docs/QuickStartEn.md index f14b9e9c..d93aa159 100644 --- a/docs/QuickStartEn.md +++ b/docs/QuickStartEn.md @@ -15,6 +15,7 @@ Quick Start * [11.Execute SQL](#110) * [12.Advanced Usage](#120) * [13.Mapping Rules](#130) +* [14.FAQ](#140) ## 1.Create database engine @@ -400,4 +401,17 @@ for i := 0; i < 10; i++ { // insert into table according id user := Userinfo{Uid: 25, Username:"sslfs"} engine.Table(fmt.Sprintf("user_%v", user.Uid % 10)).Insert(&user) -``` \ No newline at end of file +``` + + +## 14.FAQ + +1.How the xorm tag use both with json? + + Use space. + +```Go +type User struct { + Name string `json:"name" xorm:"name"` +} +```