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

Method ForEach

pkg/cache/postgres/reference.go:180–196  ·  view source on GitHub ↗

ForEach implements the required method to iterate over each reference.

(cb func(obj *plumbing.Reference) error)

Source from the content-addressed store, hash-verified

178
179// ForEach implements the required method to iterate over each reference.
180func (iter *ReferenceIter) ForEach(cb func(obj *plumbing.Reference) error) error {
181 for {
182 ref, err := iter.Next()
183 if err != nil {
184 if err == io.EOF {
185 return nil
186 }
187 return err
188 }
189 if err := cb(ref); err != nil {
190 if err == storer.ErrStop {
191 return nil
192 }
193 return err
194 }
195 }
196}
197
198// Close is a placeholder to satisfy the ReferenceIter interface.
199func (iter *ReferenceIter) Close() {

Callers

nothing calls this directly

Calls 1

NextMethod · 0.95

Tested by

no test coverage detected