cursor is closable
This commit is contained in:
parent
0915ab09fa
commit
573c398f76
@ -13,6 +13,10 @@ func (c Cursor[T]) First() *T {
|
||||
return <-c.Chan
|
||||
}
|
||||
|
||||
func (c Cursor[T]) Close() {
|
||||
defer c.cancelFunc()
|
||||
}
|
||||
|
||||
func (c Cursor[T]) Next() (*T, bool) {
|
||||
if c.ctx.Err() == nil {
|
||||
value, ok := <-c.Chan
|
||||
|
Loading…
x
Reference in New Issue
Block a user