add Conversion usage on Quickstart docs

This commit is contained in:
Lunny Xiao 2014-05-21 22:34:48 +08:00
parent f4b6ae069c
commit be48dbc82d
3 changed files with 6 additions and 2 deletions

View File

@ -1 +1 @@
xorm v0.4.0 RC1
xorm v0.4.0

View File

@ -224,6 +224,8 @@ type Conversion interface {
}
```
- 5. If one struct has a Conversion field, so we need set an implementation to the field before get data from database. We can implement `BeforeSet(name string, cell xorm.Cell)` on struct to do this. For example: [testConversion](https://github.com/go-xorm/tests/blob/master/base.go#L1826)
<a name="30" id="30"></a>
## 3. database meta information
@ -510,7 +512,7 @@ total, err := engine.Where("id >?", 1).Count(user)
```
<a name="70" id="70"></a>
## 6.更新数据
## 6.Update
更新数据使用`Update`方法Update方法的第一个参数为需要更新的内容可以为一个结构体指针或者一个Map[string]interface{}类型。当传入的为结构体指针时只有非空和0的field才会被作为更新的字段。当传入的为Map类型时key为数据库Column的名字value为要更新的内容。

View File

@ -224,6 +224,8 @@ type Conversion interface {
}
```
- 5.如果一个结构体包含一个Conversion的接口类型那么在获取数据时必须要预先设置一个实现此接口的struct或者struct的指针。此时可以在此struct中实现`BeforeSet(name string, cell xorm.Cell)`方法来进行预先给Conversion赋值。例子参见 [testConversion](https://github.com/go-xorm/tests/blob/master/base.go#L1826)
<a name="24" id="24"></a>
### 2.4.Go与字段类型对应表