MCPcopy Index your code
hub / github.com/apache/devlake / Fetch

Method Fetch

backend/helpers/pluginhelper/api/iterator.go:65–78  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

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.
65func (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
80func (c *DalCursorIterator) batchedFetch() (interface{}, errors.Error) {
81 var elems []interface{}

Callers

nothing calls this directly

Calls 3

batchedFetchMethod · 0.95
NewMethod · 0.65
FetchMethod · 0.65

Tested by

no test coverage detected