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)
    //...
}
Copyright © studygolang.com 2013 all right reserved,powered by Gitbook该文件修订时间: 2017-08-09 23:20:52

results matching ""

    No results matching ""