ForEach calls the function for each row returned by the query without loading all rows into the memory. Function can accept a struct, a pointer to a struct, an orm.Model, or values for the columns in a row. Function must return an error.
(fn interface{})
| 976 | // Function can accept a struct, a pointer to a struct, an orm.Model, |
| 977 | // or values for the columns in a row. Function must return an error. |
| 978 | func (q *Query) ForEach(fn interface{}) error { |
| 979 | m := newFuncModel(fn) |
| 980 | return q.Select(m) |
| 981 | } |
| 982 | |
| 983 | func (q *Query) forEachHasOneJoin(fn func(*join) error) error { |
| 984 | if q.tableModel == nil { |