Last active
May 2, 2024 05:38
-
-
Save buth/d603a9b1e0b76f54d36f to your computer and use it in GitHub Desktop.
Revisions
-
buth revised this gist
Feb 22, 2016 . No changes.There are no files selected for viewing
-
buth revised this gist
Feb 22, 2016 . 1 changed file with 29 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ package mongodb type iter struct { done, closed bool iter *mgo.Iter result func() interface{} } func (i *iter) Next() (interface{}, bool, error) { if !i.done { // Get a new instance. r := i.result() // Get the next value and return it. i.done = !(i.iter.Next(r)) return r, i.done, nil } if !i.closed { i.closed = true if err := i.iter.Close(); err != nil { return nil, true, err } } return nil, true, nil } -
buth created this gist
Feb 22, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ package iterator type Iterator interface { Next() (value interface{}, done bool, err error) }