diff --git a/VERSION b/VERSION index eb1bde3d..79201455 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -xorm v0.4.0 RC1 +xorm v0.4.0 diff --git a/docs/QuickStart.md b/docs/QuickStart.md index 434e3f2d..89ed0fe2 100644 --- a/docs/QuickStart.md +++ b/docs/QuickStart.md @@ -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) + ## 3. database meta information @@ -510,7 +512,7 @@ total, err := engine.Where("id >?", 1).Count(user) ``` -## 6.更新数据 +## 6.Update 更新数据使用`Update`方法,Update方法的第一个参数为需要更新的内容,可以为一个结构体指针或者一个Map[string]interface{}类型。当传入的为结构体指针时,只有非空和0的field才会被作为更新的字段。当传入的为Map类型时,key为数据库Column的名字,value为要更新的内容。 diff --git a/docs/QuickStartCN.md b/docs/QuickStartCN.md index 638bc50d..9af08f1d 100644 --- a/docs/QuickStartCN.md +++ b/docs/QuickStartCN.md @@ -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) + ### 2.4.Go与字段类型对应表