neo-go/examples/iterator/iterator.go
Evgeniy Stratonikov 7fc0c04dba core: add flags to Storage.Find
It can be iterated over keys, values or both.
Prefix can be stripped.
2021-01-15 21:12:08 +03:00

16 lines
492 B
Go

package iteratorcontract
import (
"github.com/nspcc-dev/neo-go/pkg/interop/iterator"
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
)
// NotifyKeysAndValues sends notification with `foo` storage keys and values
func NotifyKeysAndValues() bool {
iter := storage.Find(storage.GetContext(), []byte("foo"), storage.None)
for iterator.Next(iter) {
runtime.Notify("found storage key-value pair", iterator.Value(iter))
}
return true
}