MCPcopy
hub / github.com/micro/go-micro / scanRow

Function scanRow

model/sqlite/sqlite.go:334–350  ·  view source on GitHub ↗
(schema *model.Schema, row *sql.Row)

Source from the content-addressed store, hash-verified

332}
333
334func scanRow(schema *model.Schema, row *sql.Row) (map[string]any, error) {
335 ptrs := make([]any, len(schema.Fields))
336 for i, f := range schema.Fields {
337 ptrs[i] = newScanPtr(f.Type)
338 }
339 if err := row.Scan(ptrs...); err != nil {
340 if err == sql.ErrNoRows {
341 return nil, model.ErrNotFound
342 }
343 return nil, fmt.Errorf("model/sqlite: scan: %w", err)
344 }
345 result := make(map[string]any, len(schema.Fields))
346 for i, f := range schema.Fields {
347 result[f.Column] = derefScanPtr(ptrs[i], f.Type)
348 }
349 return result, nil
350}
351
352func scanRows(schema *model.Schema, rows *sql.Rows) ([]map[string]any, error) {
353 var results []map[string]any

Callers 1

ReadMethod · 0.70

Calls 4

newScanPtrFunction · 0.70
derefScanPtrFunction · 0.70
ScanMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…