| 27 | ) |
| 28 | |
| 29 | func DecodeRow(row *spanner.Row) ([]string, error) { |
| 30 | columns := make([]string, row.Size()) |
| 31 | for i := 0; i < row.Size(); i++ { |
| 32 | var column spanner.GenericColumnValue |
| 33 | if err := row.Column(i, &column); err != nil { |
| 34 | return nil, err |
| 35 | } |
| 36 | decoded, err := DecodeColumn(column) |
| 37 | if err != nil { |
| 38 | return nil, err |
| 39 | } |
| 40 | columns[i] = decoded |
| 41 | } |
| 42 | return columns, nil |
| 43 | } |
| 44 | |
| 45 | func DecodeColumn(column spanner.GenericColumnValue) (string, error) { |
| 46 | // Allowable types: https://cloud.google.com/spanner/docs/data-types#allowable-types |