| 277 | } |
| 278 | |
| 279 | func getColumnTypeName(columnType *sppb.Type) (string, error) { |
| 280 | if columnType.Code == sppb.TypeCode_STRUCT { |
| 281 | return "", errors.New("spanner STRUCT type is not supported") |
| 282 | } |
| 283 | if columnType.Code == sppb.TypeCode_ARRAY { |
| 284 | if columnType.ArrayElementType.Code == sppb.TypeCode_STRUCT { |
| 285 | return "", errors.New("spanner STRUCT type is not supported") |
| 286 | } |
| 287 | return fmt.Sprintf("[]%s", columnType.ArrayElementType.Code.String()), nil |
| 288 | } |
| 289 | return columnType.Code.String(), nil |
| 290 | } |
| 291 | |
| 292 | // getStatementWithResultLimit wraps a SQL statement in a CTE to enforce a result limit. |
| 293 | // This is a simple approach that works for SELECT queries but has a critical limitation: |