()
| 290 | } |
| 291 | |
| 292 | func (rows *baseRows) Values() ([]any, error) { |
| 293 | if rows.closed { |
| 294 | return nil, errors.New("rows is closed") |
| 295 | } |
| 296 | |
| 297 | values := make([]any, 0, len(rows.FieldDescriptions())) |
| 298 | |
| 299 | for i := range rows.FieldDescriptions() { |
| 300 | buf := rows.values[i] |
| 301 | fd := &rows.FieldDescriptions()[i] |
| 302 | |
| 303 | if buf == nil { |
| 304 | values = append(values, nil) |
| 305 | continue |
| 306 | } |
| 307 | |
| 308 | if dt, ok := rows.typeMap.TypeForOID(fd.DataTypeOID); ok { |
| 309 | value, err := dt.Codec.DecodeValue(rows.typeMap, fd.DataTypeOID, fd.Format, buf) |
| 310 | if err != nil { |
| 311 | rows.fatal(err) |
| 312 | } |
| 313 | values = append(values, value) |
| 314 | } else { |
| 315 | switch fd.Format { |
| 316 | case TextFormatCode: |
| 317 | values = append(values, string(buf)) |
| 318 | case BinaryFormatCode: |
| 319 | newBuf := make([]byte, len(buf)) |
| 320 | copy(newBuf, buf) |
| 321 | values = append(values, newBuf) |
| 322 | default: |
| 323 | rows.fatal(errors.New("unknown format code")) |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | if rows.Err() != nil { |
| 328 | return nil, rows.Err() |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | return values, rows.Err() |
| 333 | } |
| 334 | |
| 335 | func (rows *baseRows) RawValues() [][]byte { |
| 336 | return rows.values |
nothing calls this directly
no test coverage detected