Documentation
¶
Overview ¶
Package enumerator provides functions to work with enumerators.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Next ¶
func Next(e Enumerator) bool
Next moves position of the given enumerator by one and returns a bool that tells whether there is a new value present in this new position. If it is, you can use Value to get it, if not then there are no more values in this enumerator. This function uses `Neo.Enumerator.Next` syscall.
func Value ¶
func Value(e Enumerator) interface{}
Value returns current enumerator's item value, it's only valid to call it after Next returning true. This function uses `Neo.Enumerator.Value` syscall.
Types ¶
type Enumerator ¶
type Enumerator struct{}
Enumerator represents NEO enumerator type, it's an opaque data structure that can be used with functions from this package. It's similar to more widely used Iterator (see `iterator` package), but ranging over arrays or structures that have values with no explicit keys.
func Concat ¶
func Concat(a, b Enumerator) Enumerator
Concat concatenates two given enumerators returning one that will range on a first and then continue with b. Enumerator positions are not reset for a and b, so if any of them was already advanced by Next the resulting Enumerator will point at this new position and never go back to previous values. This function uses `Neo.Enumerator.Concat` syscall.
func Create ¶
func Create(items []interface{}) Enumerator
Create creates a new enumerator from the given items (slice or structure). New enumerator points at index -1 of its items, so the user of it has to advance it first with Next. This function uses `Neo.Enumerator.Create` syscall.