Iterate records
On this page
5.6.Iterate records
Iterate
, like Find
, but handle objects one by one.
err := engine.Where("age > ? or name=?)", 30, "xlw").Iterate(new(Userinfo), func(i int, bean interface{})error{
user := bean.(*Userinfo)
//do somthing use i and user
})