MCPcopy Create free account
hub / github.com/cloudquery/cloudquery / getValue

Function getValue

plugins/destination/mysql/client/transformer.go:9–63  ·  view source on GitHub ↗
(arr arrow.Array, i int)

Source from the content-addressed store, hash-verified

7)
8
9func getValue(arr arrow.Array, i int) (any, error) {
10 if arr.IsNull(i) {
11 return nil, nil
12 }
13 switch a := arr.(type) {
14 case *array.Boolean:
15 return a.Value(i), nil
16 case *array.Int8:
17 return a.Value(i), nil
18 case *array.Int16:
19 return a.Value(i), nil
20 case *array.Int32:
21 return a.Value(i), nil
22 case *array.Int64:
23 return a.Value(i), nil
24 case *array.Uint8:
25 return a.Value(i), nil
26 case *array.Uint16:
27 return a.Value(i), nil
28 case *array.Uint32:
29 return a.Value(i), nil
30 case *array.Uint64:
31 return a.Value(i), nil
32 case *array.Float16:
33 return a.Value(i), nil
34 case *array.Float32:
35 return a.Value(i), nil
36 case *array.Float64:
37 return a.Value(i), nil
38 case *array.String:
39 return a.Value(i), nil
40 case *array.LargeString:
41 return a.Value(i), nil
42 case *array.Binary:
43 return a.Value(i), nil
44 case *array.LargeBinary:
45 return a.Value(i), nil
46 case *array.FixedSizeBinary:
47 return a.Value(i), nil
48 case *array.Timestamp:
49 toTime, err := a.DataType().(*arrow.TimestampType).GetToTimeFunc()
50 if err != nil {
51 return nil, err
52 }
53 return toTime(a.Value(i)), nil
54 case *types.UUIDArray:
55 bUUID, err := a.Value(i).MarshalBinary()
56 if err != nil {
57 return nil, err
58 }
59 return bUUID, nil
60 default:
61 return a.ValueStr(i), nil
62 }
63}
64
65func transformRecord(record arrow.RecordBatch) ([][]any, error) {
66 res := make([][]any, record.NumRows())

Callers 1

transformRecordFunction · 0.70

Calls 1

ValueMethod · 0.65

Tested by

no test coverage detected