imporved readme

This commit is contained in:
Lunny Xiao 2013-05-16 14:12:27 +08:00
parent d3c4644b17
commit 8a08aadd0f
2 changed files with 17 additions and 3 deletions

View File

@ -152,6 +152,7 @@ total, err := engine.Count(&User{Name:"xlw"})
``` ```
##Execute SQL ##Execute SQL
Of course, SQL execution is also provided. Of course, SQL execution is also provided.
1.if select then use Query 1.if select then use Query
@ -169,6 +170,7 @@ res, err := engine.Exec(sql, "xiaolun", 1)
``` ```
##Advanced Usage ##Advanced Usage
for deep usage, you should create a session, this func will create a database connection immediatelly for deep usage, you should create a session, this func will create a database connection immediatelly
```Go ```Go
@ -268,6 +270,7 @@ if err != nil {
``` ```
##Mapping Rules ##Mapping Rules
<a name="mapping" id="mapping"></a> <a name="mapping" id="mapping"></a>
1.Struct and struct's fields name should be Pascal style, and the table and column's name default is SQL style. 1.Struct and struct's fields name should be Pascal style, and the table and column's name default is SQL style.
@ -316,8 +319,11 @@ type Userinfo struct {
``` ```
##Documents ##Documents
Please visit [GoWalker](http://gowalker.org/github.com/lunny/xorm) Please visit [GoWalker](http://gowalker.org/github.com/lunny/xorm)
##FAQ ##FAQ
1.How the xorm tag use both with json? 1.How the xorm tag use both with json?
Use space. Use space.

View File

@ -1,4 +1,5 @@
# xorm # xorm
[English](https://github.com/lunny/xorm/blob/master/README.md) [English](https://github.com/lunny/xorm/blob/master/README.md)
xorm是一个Go语言的ORM库. 通过它可以使数据库操作非常简便。 xorm是一个Go语言的ORM库. 通过它可以使数据库操作非常简便。
@ -6,6 +7,7 @@ xorm是一个Go语言的ORM库. 通过它可以使数据库操作非常简便。
目前没有正式的项目来使用此库,如果有,我们将会把它列出来。 目前没有正式的项目来使用此库,如果有,我们将会把它列出来。
## 驱动支持 ## 驱动支持
目前支持的Go数据库驱动如下 目前支持的Go数据库驱动如下
* Mysql: [github.com/Go-SQL-Driver/MySQL](https://github.com/Go-SQL-Driver/MySQL) * Mysql: [github.com/Go-SQL-Driver/MySQL](https://github.com/Go-SQL-Driver/MySQL)
@ -19,6 +21,7 @@ xorm是一个Go语言的ORM库. 通过它可以使数据库操作非常简便。
* **v0.1.0** : 初始化工程 * **v0.1.0** : 初始化工程
## 特性 ## 特性
* 支持Struct和数据库表之间的映射映射方式支持命名约定和Tag两种方式 * 支持Struct和数据库表之间的映射映射方式支持命名约定和Tag两种方式
* 事务支持 * 事务支持
@ -146,6 +149,7 @@ total, err := engine.Count(&User{Name:"xlw"})
``` ```
##直接执行SQL语句 ##直接执行SQL语句
当然如果你想直接使用SQL语句进行操作也是允许的。 当然如果你想直接使用SQL语句进行操作也是允许的。
如果执行Select请用Query() 如果执行Select请用Query()
@ -163,6 +167,7 @@ res, err := engine.Exec(sql, "xiaolun", 1)
``` ```
##高级用法 ##高级用法
<a name="mapping" id="mapping"></a> <a name="mapping" id="mapping"></a>
更高级的用法我们必须要使用session对象session对象在创建时会立刻创建一个数据库连接。 更高级的用法我们必须要使用session对象session对象在创建时会立刻创建一个数据库连接。
@ -263,6 +268,7 @@ if err != nil {
``` ```
## 映射规则 ## 映射规则
1.Struct 和 Struct 的field名字应该为Pascal式命名默认的映射规则将转换成用下划线连接的命名规则这个映射是自动进行的当然你可以通过修改Engine的成员Mapper来改变它。 1.Struct 和 Struct 的field名字应该为Pascal式命名默认的映射规则将转换成用下划线连接的命名规则这个映射是自动进行的当然你可以通过修改Engine的成员Mapper来改变它。
例如: 例如:
@ -310,9 +316,11 @@ type Userinfo struct {
``` ```
##文档 ##文档
请访问 [GoWalker](http://gowalker.org/github.com/lunny/xorm) 查看详细文档 请访问 [GoWalker](http://gowalker.org/github.com/lunny/xorm) 查看详细文档
##FAQ ##FAQ
1.问xorm的tag和json的tag如何同时起作用 1.问xorm的tag和json的tag如何同时起作用
答案:使用空格分开 答案:使用空格分开