Skip to content

Commit 2c9fb37

Browse files
Google APIscopybara-github
authored andcommitted
feat: add INTERVAL API
PiperOrigin-RevId: 680405503
1 parent d6f1848 commit 2c9fb37

1 file changed

Lines changed: 43 additions & 30 deletions

File tree

google/spanner/v1/type.proto

Lines changed: 43 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,24 @@ message Type {
3232
// Required. The [TypeCode][google.spanner.v1.TypeCode] for this type.
3333
TypeCode code = 1 [(google.api.field_behavior) = REQUIRED];
3434

35-
// If [code][google.spanner.v1.Type.code] == [ARRAY][google.spanner.v1.TypeCode.ARRAY], then `array_element_type`
36-
// is the type of the array elements.
35+
// If [code][google.spanner.v1.Type.code] ==
36+
// [ARRAY][google.spanner.v1.TypeCode.ARRAY], then `array_element_type` is the
37+
// type of the array elements.
3738
Type array_element_type = 2;
3839

39-
// If [code][google.spanner.v1.Type.code] == [STRUCT][google.spanner.v1.TypeCode.STRUCT], then `struct_type`
40-
// provides type information for the struct's fields.
40+
// If [code][google.spanner.v1.Type.code] ==
41+
// [STRUCT][google.spanner.v1.TypeCode.STRUCT], then `struct_type` provides
42+
// type information for the struct's fields.
4143
StructType struct_type = 3;
4244

43-
// The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that disambiguates SQL type that Spanner will
44-
// use to represent values of this type during query processing. This is
45-
// necessary for some type codes because a single [TypeCode][google.spanner.v1.TypeCode] can be mapped
46-
// to different SQL types depending on the SQL dialect. [type_annotation][google.spanner.v1.Type.type_annotation]
47-
// typically is not needed to process the content of a value (it doesn't
48-
// affect serialization) and clients can ignore it on the read path.
45+
// The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that
46+
// disambiguates SQL type that Spanner will use to represent values of this
47+
// type during query processing. This is necessary for some type codes because
48+
// a single [TypeCode][google.spanner.v1.TypeCode] can be mapped to different
49+
// SQL types depending on the SQL dialect.
50+
// [type_annotation][google.spanner.v1.Type.type_annotation] typically is not
51+
// needed to process the content of a value (it doesn't affect serialization)
52+
// and clients can ignore it on the read path.
4953
TypeAnnotationCode type_annotation = 4;
5054

5155
// If [code][google.spanner.v1.Type.code] ==
@@ -56,7 +60,8 @@ message Type {
5660
string proto_type_fqn = 5;
5761
}
5862

59-
// `StructType` defines the fields of a [STRUCT][google.spanner.v1.TypeCode.STRUCT] type.
63+
// `StructType` defines the fields of a
64+
// [STRUCT][google.spanner.v1.TypeCode.STRUCT] type.
6065
message StructType {
6166
// Message representing a single field of a struct.
6267
message Field {
@@ -76,9 +81,9 @@ message StructType {
7681
// The list of fields that make up this struct. Order is
7782
// significant, because values of this struct type are represented as
7883
// lists, where the order of field values matches the order of
79-
// fields in the [StructType][google.spanner.v1.StructType]. In turn, the order of fields
80-
// matches the order of columns in a read request, or the order of
81-
// fields in the `SELECT` clause of a query.
84+
// fields in the [StructType][google.spanner.v1.StructType]. In turn, the
85+
// order of fields matches the order of columns in a read request, or the
86+
// order of fields in the `SELECT` clause of a query.
8287
repeated Field fields = 1;
8388
}
8489

@@ -137,14 +142,14 @@ enum TypeCode {
137142
STRUCT = 9;
138143

139144
// Encoded as `string`, in decimal format or scientific notation format.
140-
// <br>Decimal format:
141-
// <br>`[+-]Digits[.[Digits]]` or
142-
// <br>`[+-][Digits].Digits`
145+
// Decimal format:
146+
// `[+-]Digits[.[Digits]]` or
147+
// `[+-][Digits].Digits`
143148
//
144149
// Scientific notation:
145-
// <br>`[+-]Digits[.[Digits]][ExponentIndicator[+-]Digits]` or
146-
// <br>`[+-][Digits].Digits[ExponentIndicator[+-]Digits]`
147-
// <br>(ExponentIndicator is `"e"` or `"E"`)
150+
// `[+-]Digits[.[Digits]][ExponentIndicator[+-]Digits]` or
151+
// `[+-][Digits].Digits[ExponentIndicator[+-]Digits]`
152+
// (ExponentIndicator is `"e"` or `"E"`)
148153
NUMERIC = 10;
149154

150155
// Encoded as a JSON-formatted `string` as described in RFC 7159. The
@@ -163,6 +168,13 @@ enum TypeCode {
163168

164169
// Encoded as `string`, in decimal format.
165170
ENUM = 14;
171+
172+
// Encoded as `string`, in `ISO8601` duration format -
173+
// `P[n]Y[n]M[n]DT[n]H[n]M[n[.fraction]]S`
174+
// where `n` is an integer.
175+
// For example, `P1Y2M3DT4H5M6.5S` represents time duration of 1 year, 2
176+
// months, 3 days, 4 hours, 5 minutes, and 6.5 seconds.
177+
INTERVAL = 16;
166178
}
167179

168180
// `TypeAnnotationCode` is used as a part of [Type][google.spanner.v1.Type] to
@@ -175,19 +187,20 @@ enum TypeAnnotationCode {
175187
TYPE_ANNOTATION_CODE_UNSPECIFIED = 0;
176188

177189
// PostgreSQL compatible NUMERIC type. This annotation needs to be applied to
178-
// [Type][google.spanner.v1.Type] instances having [NUMERIC][google.spanner.v1.TypeCode.NUMERIC]
179-
// type code to specify that values of this type should be treated as
180-
// PostgreSQL NUMERIC values. Currently this annotation is always needed for
181-
// [NUMERIC][google.spanner.v1.TypeCode.NUMERIC] when a client interacts with PostgreSQL-enabled
182-
// Spanner databases.
190+
// [Type][google.spanner.v1.Type] instances having
191+
// [NUMERIC][google.spanner.v1.TypeCode.NUMERIC] type code to specify that
192+
// values of this type should be treated as PostgreSQL NUMERIC values.
193+
// Currently this annotation is always needed for
194+
// [NUMERIC][google.spanner.v1.TypeCode.NUMERIC] when a client interacts with
195+
// PostgreSQL-enabled Spanner databases.
183196
PG_NUMERIC = 2;
184197

185198
// PostgreSQL compatible JSONB type. This annotation needs to be applied to
186-
// [Type][google.spanner.v1.Type] instances having [JSON][google.spanner.v1.TypeCode.JSON]
187-
// type code to specify that values of this type should be treated as
188-
// PostgreSQL JSONB values. Currently this annotation is always needed for
189-
// [JSON][google.spanner.v1.TypeCode.JSON] when a client interacts with PostgreSQL-enabled
190-
// Spanner databases.
199+
// [Type][google.spanner.v1.Type] instances having
200+
// [JSON][google.spanner.v1.TypeCode.JSON] type code to specify that values of
201+
// this type should be treated as PostgreSQL JSONB values. Currently this
202+
// annotation is always needed for [JSON][google.spanner.v1.TypeCode.JSON]
203+
// when a client interacts with PostgreSQL-enabled Spanner databases.
191204
PG_JSONB = 3;
192205

193206
// PostgreSQL compatible OID type. This annotation can be used by a client

0 commit comments

Comments
 (0)