ForEach call the cb function for each commit contained on this iter until an error appends or the end of the iter is reached. If ErrStop is sent the iteration is stopped but no error is returned. The iterator is closed.
(cb func(CommitNode) error)
| 78 | // an error appends or the end of the iter is reached. If ErrStop is sent |
| 79 | // the iteration is stopped but no error is returned. The iterator is closed. |
| 80 | func (iter *parentCommitNodeIter) ForEach(cb func(CommitNode) error) error { |
| 81 | for { |
| 82 | obj, err := iter.Next() |
| 83 | if err != nil { |
| 84 | if err == io.EOF { |
| 85 | return nil |
| 86 | } |
| 87 | |
| 88 | return err |
| 89 | } |
| 90 | |
| 91 | if err := cb(obj); err != nil { |
| 92 | if err == storer.ErrStop { |
| 93 | return nil |
| 94 | } |
| 95 | |
| 96 | return err |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | func (iter *parentCommitNodeIter) Close() { |
| 102 | } |