diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-16 01:07:18 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-16 01:07:18 +0200 |
commit | 46048b6f6cbbdf20d130540e9ef823574e786240 (patch) | |
tree | 24d6e6019365ed5c81535a686a7102d00ed80fda /examples/object_storage/storage.go | |
parent | a8fd3fd6c8970bbf2d21e97c33fbb131f2fd4167 (diff) | |
download | go-git-46048b6f6cbbdf20d130540e9ef823574e786240.tar.gz |
example: fix storag example
Diffstat (limited to 'examples/object_storage/storage.go')
-rw-r--r-- | examples/object_storage/storage.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/object_storage/storage.go b/examples/object_storage/storage.go index 5868591..bb9ff29 100644 --- a/examples/object_storage/storage.go +++ b/examples/object_storage/storage.go @@ -137,6 +137,27 @@ func (i *AerospikeObjectIter) Next() (core.Object, error) { return o, nil } +func (i *AerospikeObjectIter) ForEach(cb func(obj core.Object) error) error { + for { + obj, err := i.Next() + if err != nil { + if err == io.EOF { + return nil + } + + return err + } + + if err := cb(obj); err != nil { + if err == core.ErrStop { + return nil + } + + return err + } + } +} + func (i *AerospikeObjectIter) Close() {} type AerospikeReferenceStorage struct { |