Skip to content

Commit 385391b

Browse files
authored
Merge pull request astaxie#1092 from hjlarry/patch-1
Update 05.5.md
2 parents 9b4cb79 + 176e409 commit 385391b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

zh/05.5.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,12 @@ type Tag struct {
218218

219219
func init() {
220220
// 需要在init中注册定义的model
221-
orm.RegisterModel(new(Userinfo),new(User), new(Profile), new(Tag))
221+
orm.RegisterModel(new(Userinfo),new(User), new(Profile), new(Post), new(Tag))
222222
}
223223

224224

225225
```
226-
>注意一点,beego orm针对驼峰命名会自动帮你转化成下划线字段,例如你定义了Struct名字为`UserInfo`,那么转化成底层实现的时候是`user_info`,字段命名也遵循该规则。
226+
>注意一点,beego orm针对驼峰命名会自动帮你转化成下划线字段,例如你定义了struct名字为`UserInfo`,那么转化成底层实现的时候是`user_info`,字段命名也遵循该规则。
227227
228228
## 插入数据
229229
下面的代码演示了如何插入一条记录,可以看到我们操作的是struct对象,而不是原生的sql语句,最后通过调用Insert接口将数据保存到数据库。
@@ -287,7 +287,7 @@ o.Update(&user, "Name")
287287
// o.Update(&user, "Field1", "Field2", ...)
288288
```
289289

290-
//Where:用来设置条件,支持多个参数,第一个参数如果为整数,相当于调用了Where("主键=?",值)。
290+
Where: 用来设置条件,支持多个参数,第一个参数如果为整数,相当于调用了Where("主键=?",值)。
291291

292292
## 查询数据
293293
beego orm的查询接口比较灵活,具体使用请看下面的例子
@@ -384,7 +384,7 @@ num, err := qs.Filter("User__Name", "slene").All(&posts)
384384

385385

386386

387-
## Group By和Having
387+
## GroupBy和Having
388388
针对有些应用需要用到group by的功能,beego orm也提供了一个简陋的实现
389389
```Go
390390

0 commit comments

Comments
 (0)