From 1d1b4d4c18db357f725f93566f5f6feeb21cd2d0 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Wed, 23 Mar 2022 22:04:17 +0300 Subject: [PATCH] examples: extend iterator with more storage options --- examples/iterator/iterator.go | 9 +++++++++ examples/iterator/iterator.yml | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/examples/iterator/iterator.go b/examples/iterator/iterator.go index 4c830cf6f..a30233fb5 100644 --- a/examples/iterator/iterator.go +++ b/examples/iterator/iterator.go @@ -22,3 +22,12 @@ func NotifyKeysAndValues() bool { } return true } + +// NotifyValues sends notification with `foo` storage values. +func NotifyValues() bool { + iter := storage.Find(storage.GetContext(), []byte("foo"), storage.ValuesOnly) + for iterator.Next(iter) { + runtime.Notify("Value", iterator.Value(iter)) + } + return true +} diff --git a/examples/iterator/iterator.yml b/examples/iterator/iterator.yml index 1c6477104..ddd62c869 100644 --- a/examples/iterator/iterator.yml +++ b/examples/iterator/iterator.yml @@ -6,3 +6,7 @@ events: parameters: - name: value type: Any + - name: Value + parameters: + - name: value + type: Any