Fetch if batching is disabled, it'll read a single row, otherwise it'll read as many rows up to the batch size, and the runtime return type will be []interface{}. Note, HasNext needs to have been called before invoking this.
()
| 63 | // Fetch if batching is disabled, it'll read a single row, otherwise it'll read as many rows up to the batch size, and the |
| 64 | // runtime return type will be []interface{}. Note, HasNext needs to have been called before invoking this. |
| 65 | func (c *DalCursorIterator) Fetch() (interface{}, errors.Error) { |
| 66 | if c.batchSize > 0 { |
| 67 | return c.batchedFetch() |
| 68 | } |
| 69 | if c.batchSize != -1 { |
| 70 | panic("invalid batch size") |
| 71 | } |
| 72 | elem := reflect.New(c.elemType).Interface() |
| 73 | err := c.db.Fetch(c.cursor, elem) |
| 74 | if err != nil { |
| 75 | return nil, err |
| 76 | } |
| 77 | return elem, nil |
| 78 | } |
| 79 | |
| 80 | func (c *DalCursorIterator) batchedFetch() (interface{}, errors.Error) { |
| 81 | var elems []interface{} |
nothing calls this directly
no test coverage detected