MCPcopy Create free account
hub / github.com/bytebase/bytebase / getColumnTypeName

Function getColumnTypeName

backend/plugin/db/spanner/spanner.go:279–290  ·  view source on GitHub ↗
(columnType *sppb.Type)

Source from the content-addressed store, hash-verified

277}
278
279func 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:

Callers 2

TestGetColumnTypeNameFunction · 0.85
getColumnTypeNamesFunction · 0.85

Calls 1

StringMethod · 0.65

Tested by 1

TestGetColumnTypeNameFunction · 0.68