def findMap[T](by: QueryParam[A]*)(f: A => Box[T]) Your function, f, will be called as each row is pulled back from the database. If your function returns Empty, the row will not be included in the final result. You can also do fun stuff like:
MyModel.findMap(){ row -> row.name.is match { case x if x.length < 4 => Full(x) case _ => Empty }} This will return a List[String] for all the people with short names. Your function is called as each row is processed, so the whole list is not loaded into memory. If you wanted to simulate a foreach here, you'd just return Empty from the function every time. On Wed, Jan 27, 2010 at 9:58 PM, Naftoli Gugenheim <naftoli...@gmail.com>wrote: > MetaMapper has a findAll method, which creates a statement based on its > parameters, and then iterates over the ResultSet creating Mappers and > putting them into a List. > It would be neat if it was possible to process the generated Mappers one by > one instead of loading them into a list. This way large ResultSets don't > need to result in a big List in memory. > Is such a thing possible today? If not, what would it take to implement? > One approach would be foreach/map/flatMap methods. Another would be a find > method that returns a lazy list or an Iterator. > Thanks. > > > -- > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. > -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.