@@ -16,6 +16,7 @@ syntax = "proto3";
|
16 | 16 |
|
17 | 17 | package google.spanner.v1;
|
18 | 18 |
|
| 19 | +import "google/api/field_behavior.proto"; |
19 | 20 | import "google/api/annotations.proto";
|
20 | 21 |
|
21 | 22 | option csharp_namespace = "Google.Cloud.Spanner.V1";
|
@@ -26,6 +27,47 @@ option java_package = "com.google.spanner.v1";
|
26 | 27 | option php_namespace = "Google\\Cloud\\Spanner\\V1";
|
27 | 28 | option ruby_package = "Google::Cloud::Spanner::V1";
|
28 | 29 |
|
| 30 | +// `Type` indicates the type of a Cloud Spanner value, as might be stored in a |
| 31 | +// table cell or returned from an SQL query. |
| 32 | +message Type { |
| 33 | +// Required. The [TypeCode][google.spanner.v1.TypeCode] for this type. |
| 34 | +TypeCode code = 1 [(google.api.field_behavior) = REQUIRED]; |
| 35 | + |
| 36 | +// If [code][google.spanner.v1.Type.code] == [ARRAY][google.spanner.v1.TypeCode.ARRAY], then `array_element_type` |
| 37 | +// is the type of the array elements. |
| 38 | +Type array_element_type = 2; |
| 39 | + |
| 40 | +// If [code][google.spanner.v1.Type.code] == [STRUCT][google.spanner.v1.TypeCode.STRUCT], then `struct_type` |
| 41 | +// provides type information for the struct's fields. |
| 42 | +StructType struct_type = 3; |
| 43 | +} |
| 44 | + |
| 45 | +// `StructType` defines the fields of a [STRUCT][google.spanner.v1.TypeCode.STRUCT] type. |
| 46 | +message StructType { |
| 47 | +// Message representing a single field of a struct. |
| 48 | +message Field { |
| 49 | +// The name of the field. For reads, this is the column name. For |
| 50 | +// SQL queries, it is the column alias (e.g., `"Word"` in the |
| 51 | +// query `"SELECT 'hello' AS Word"`), or the column name (e.g., |
| 52 | +// `"ColName"` in the query `"SELECT ColName FROM Table"`). Some |
| 53 | +// columns might have an empty name (e.g., !"SELECT |
| 54 | +// UPPER(ColName)"`). Note that a query result can contain |
| 55 | +// multiple fields with the same name. |
| 56 | +string name = 1; |
| 57 | + |
| 58 | +// The type of the field. |
| 59 | +Type type = 2; |
| 60 | +} |
| 61 | + |
| 62 | +// The list of fields that make up this struct. Order is |
| 63 | +// significant, because values of this struct type are represented as |
| 64 | +// lists, where the order of field values matches the order of |
| 65 | +// fields in the [StructType][google.spanner.v1.StructType]. In turn, the order of fields |
| 66 | +// matches the order of columns in a read request, or the order of |
| 67 | +// fields in the `SELECT` clause of a query. |
| 68 | +repeated Field fields = 1; |
| 69 | +} |
| 70 | + |
29 | 71 | // `TypeCode` is used as part of [Type][google.spanner.v1.Type] to
|
30 | 72 | // indicate the type of a Cloud Spanner value.
|
31 | 73 | //
|
@@ -75,45 +117,15 @@ enum TypeCode {
|
75 | 117 | // Encoded as `list`, where list element `i` is represented according
|
76 | 118 | // to [struct_type.fields[i]][google.spanner.v1.StructType.fields].
|
77 | 119 | STRUCT = 9;
|
78 |
| -} |
79 |
| - |
80 |
| -// `Type` indicates the type of a Cloud Spanner value, as might be stored in a |
81 |
| -// table cell or returned from an SQL query. |
82 |
| -message Type { |
83 |
| -// Required. The [TypeCode][google.spanner.v1.TypeCode] for this type. |
84 |
| -TypeCode code = 1; |
85 |
| - |
86 |
| -// If [code][google.spanner.v1.Type.code] == [ARRAY][google.spanner.v1.TypeCode.ARRAY], then `array_element_type` |
87 |
| -// is the type of the array elements. |
88 |
| -Type array_element_type = 2; |
89 |
| - |
90 |
| -// If [code][google.spanner.v1.Type.code] == [STRUCT][google.spanner.v1.TypeCode.STRUCT], then `struct_type` |
91 |
| -// provides type information for the struct's fields. |
92 |
| -StructType struct_type = 3; |
93 |
| -} |
94 |
| - |
95 |
| -// `StructType` defines the fields of a [STRUCT][google.spanner.v1.TypeCode.STRUCT] type. |
96 |
| -message StructType { |
97 |
| -// Message representing a single field of a struct. |
98 |
| -message Field { |
99 |
| -// The name of the field. For reads, this is the column name. For |
100 |
| -// SQL queries, it is the column alias (e.g., `"Word"` in the |
101 |
| -// query `"SELECT 'hello' AS Word"`), or the column name (e.g., |
102 |
| -// `"ColName"` in the query `"SELECT ColName FROM Table"`). Some |
103 |
| -// columns might have an empty name (e.g., !"SELECT |
104 |
| -// UPPER(ColName)"`). Note that a query result can contain |
105 |
| -// multiple fields with the same name. |
106 |
| -string name = 1; |
107 |
| - |
108 |
| -// The type of the field. |
109 |
| -Type type = 2; |
110 |
| -} |
111 | 120 |
|
112 |
| -// The list of fields that make up this struct. Order is |
113 |
| -// significant, because values of this struct type are represented as |
114 |
| -// lists, where the order of field values matches the order of |
115 |
| -// fields in the [StructType][google.spanner.v1.StructType]. In turn, the order of fields |
116 |
| -// matches the order of columns in a read request, or the order of |
117 |
| -// fields in the `SELECT` clause of a query. |
118 |
| -repeated Field fields = 1; |
| 121 | +// Encoded as `string`, in decimal format or scientific notation format. |
| 122 | +// <br>Decimal format: |
| 123 | +// <br>`[+-]Digits[.[Digits]]` or |
| 124 | +// <br>`[+-][Digits].Digits` |
| 125 | +// |
| 126 | +// Scientific notation: |
| 127 | +// <br>`[+-]Digits[.[Digits]][ExponentIndicator[+-]Digits]` or |
| 128 | +// <br>`[+-][Digits].Digits[ExponentIndicator[+-]Digits]` |
| 129 | +// <br>(ExponentIndicator is `"e"` or `"E"`) |
| 130 | +NUMERIC = 10; |
119 | 131 | }
|
0 commit comments