(ctx context.Context, table *schema.Table, res chan<- arrow.RecordBatch)
| 224 | } |
| 225 | |
| 226 | func (c *Client) Read(ctx context.Context, table *schema.Table, res chan<- arrow.RecordBatch) error { |
| 227 | colNames := make([]string, len(table.Columns)) |
| 228 | for i, col := range table.Columns { |
| 229 | colNames[i] = identifier(col.Name) |
| 230 | } |
| 231 | cols := strings.Join(colNames, ", ") |
| 232 | read := fmt.Sprintf(readSQL, cols, table.Name) |
| 233 | rows, err := c.db.QueryContext(ctx, read) |
| 234 | if err != nil { |
| 235 | return err |
| 236 | } |
| 237 | defer rows.Close() |
| 238 | arrowSchemaTable := table.ToArrowSchema() |
| 239 | for rows.Next() { |
| 240 | values := c.createResultsArray(arrowSchemaTable) |
| 241 | if err := rows.Scan(values...); err != nil { |
| 242 | return fmt.Errorf("failed to read from table %s: %w", table.Name, err) |
| 243 | } |
| 244 | record, err := reverseTransform(arrowSchemaTable, values) |
| 245 | if err != nil { |
| 246 | return err |
| 247 | } |
| 248 | res <- record |
| 249 | } |
| 250 | return nil |
| 251 | } |
nothing calls this directly
no test coverage detected