MCPcopy Create free account
hub / github.com/encoder-run/operator / ForEach

Method ForEach

pkg/cache/postgres/object.go:167–183  ·  view source on GitHub ↗

ForEach implements the required method to iterate over each object.

(cb func(obj plumbing.EncodedObject) error)

Source from the content-addressed store, hash-verified

165
166// ForEach implements the required method to iterate over each object.
167func (iter *EncodedObjectIter) ForEach(cb func(obj plumbing.EncodedObject) error) error {
168 for {
169 obj, err := iter.Next()
170 if err != nil {
171 if err == io.EOF {
172 return nil
173 }
174 return err
175 }
176 if err := cb(obj); err != nil {
177 if err == storer.ErrStop {
178 return nil
179 }
180 return err
181 }
182 }
183}
184
185// Close is a placeholder to satisfy the EncodedObjectIter interface.
186func (iter *EncodedObjectIter) Close() {

Callers

nothing calls this directly

Calls 1

NextMethod · 0.95

Tested by

no test coverage detected