Skip to content

reiver/go-iter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-iter

Package iter provides tools for creating iterators, for the Go programming language.

These iterators are intentionally made to resemble *sql.Rows from the "database/sql" package. Including having the same Close, Err, Next, and Scan methods.

(Note that to turn something into an actual *sql.Rows from the "database/sql" package, instead of just resembling it, use https://github.com/reiver/go-shunt instead.)

Documention

Online documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-iter

GoDoc

Example

var slice []string = []string {
	"apple",
	"banana",
	"cherry",
}

iterator := iterstring.Slice{
	Slice: slice,
}

defer iterator.Close()

for iterator.Next() {

	var datum string // Could have also used: var datum interface{}

	if err := iterator.Decode(&datum); nil != err {
		return err
	}

	fmt.Printf("Next datum: %v \n", datum)
}
if err := iterator.Err(); nil != err {
	return err
}

Import

To import package iter use import code like the follownig:

import "github.com/reiver/go-iter"

Installation

To install package iter do the following:

GOPROXY=direct go get github.com/reiver/go-iter

Author

Package iter was written by Charles Iliya Krempeaux

About

Package iter provides tools for creating iterators, for the Go programming language.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages