This repository has been archived on 2022-04-14. You can view files and clone it, but cannot push or open issues or pull requests.
manual-zh-CN/chapter-05/8.rows.md
2014-11-24 22:53:21 +08:00

301 B
Raw Permalink Blame History

Rows方法

Rows方法和Iterate方法类似提供逐条执行查询到的记录的方法不过Rows更加灵活好用。

user := new(User)
rows, err := engine.Where("id >?", 1).Rows(user)
if err != nil {
}
defer rows.Close()
for rows.Next() {
    err = rows.Scan(user)
    //...
}