You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
383 B
23 lines
383 B
package redis
|
|
|
|
type Iterator struct {
|
|
data []interface{}
|
|
index int
|
|
}
|
|
|
|
func NewIterator(data []interface{}) *Iterator {
|
|
return &Iterator{data: data}
|
|
}
|
|
func (i *Iterator) HasNext() bool {
|
|
if i.data == nil || len(i.data) == 0 {
|
|
return false
|
|
}
|
|
return i.index < len(i.data)
|
|
}
|
|
|
|
func (i *Iterator) Next() (Ret interface{}) {
|
|
Ret = i.data[i.index]
|
|
i.index = i.index + 1
|
|
return
|
|
}
|