@google-cloud/spanner-api 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +111 -0
- package/build/protos/google/spanner/admin/database/v1/backup.proto +773 -0
- package/build/protos/google/spanner/admin/database/v1/backup_schedule.proto +230 -0
- package/build/protos/google/spanner/admin/database/v1/common.proto +132 -0
- package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +1314 -0
- package/build/protos/google/spanner/admin/instance/v1/common.proto +64 -0
- package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +2184 -0
- package/build/protos/google/spanner/executor/v1/cloud_executor.proto +1610 -0
- package/build/protos/google/spanner/v1/change_stream.proto +451 -0
- package/build/protos/google/spanner/v1/commit_response.proto +80 -0
- package/build/protos/google/spanner/v1/keys.proto +163 -0
- package/build/protos/google/spanner/v1/location.proto +388 -0
- package/build/protos/google/spanner/v1/mutation.proto +156 -0
- package/build/protos/google/spanner/v1/query_plan.proto +156 -0
- package/build/protos/google/spanner/v1/result_set.proto +260 -0
- package/build/protos/google/spanner/v1/spanner.proto +1472 -0
- package/build/protos/google/spanner/v1/transaction.proto +329 -0
- package/build/protos/google/spanner/v1/type.proto +214 -0
- package/build/protos/protos.d.ts +42547 -0
- package/build/protos/protos.js +1 -0
- package/build/protos/protos.json +1 -0
- package/build/src/index.d.ts +20 -0
- package/build/src/index.js +34 -0
- package/build/src/index.js.map +1 -0
- package/build/src/v1/database_admin_client.d.ts +2433 -0
- package/build/src/v1/database_admin_client.js +2938 -0
- package/build/src/v1/database_admin_client.js.map +1 -0
- package/build/src/v1/database_admin_client_config.json +169 -0
- package/build/src/v1/database_admin_proto_list.json +6 -0
- package/build/src/v1/gapic_metadata.json +253 -0
- package/build/src/v1/index.d.ts +4 -0
- package/build/src/v1/index.js +29 -0
- package/build/src/v1/index.js.map +1 -0
- package/build/src/v1/instance_admin_client.d.ts +2162 -0
- package/build/src/v1/instance_admin_client.js +2411 -0
- package/build/src/v1/instance_admin_client.js.map +1 -0
- package/build/src/v1/instance_admin_client_config.json +129 -0
- package/build/src/v1/instance_admin_proto_list.json +4 -0
- package/build/src/v1/spanner_client.d.ts +1353 -0
- package/build/src/v1/spanner_client.js +1456 -0
- package/build/src/v1/spanner_client.js.map +1 -0
- package/build/src/v1/spanner_client_config.json +123 -0
- package/build/src/v1/spanner_executor_proxy_client.d.ts +419 -0
- package/build/src/v1/spanner_executor_proxy_client.js +730 -0
- package/build/src/v1/spanner_executor_proxy_client.js.map +1 -0
- package/build/src/v1/spanner_executor_proxy_client_config.json +30 -0
- package/build/src/v1/spanner_executor_proxy_proto_list.json +15 -0
- package/build/src/v1/spanner_proto_list.json +12 -0
- package/package.json +65 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
// Copyright 2026 Google LLC
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
syntax = "proto3";
|
|
16
|
+
|
|
17
|
+
package google.spanner.v1;
|
|
18
|
+
|
|
19
|
+
import "google/api/field_behavior.proto";
|
|
20
|
+
import "google/protobuf/duration.proto";
|
|
21
|
+
import "google/protobuf/timestamp.proto";
|
|
22
|
+
import "google/spanner/v1/location.proto";
|
|
23
|
+
|
|
24
|
+
option csharp_namespace = "Google.Cloud.Spanner.V1";
|
|
25
|
+
option go_package = "cloud.google.com/go/spanner/apiv1/spannerpb;spannerpb";
|
|
26
|
+
option java_multiple_files = true;
|
|
27
|
+
option java_outer_classname = "TransactionProto";
|
|
28
|
+
option java_package = "com.google.spanner.v1";
|
|
29
|
+
option php_namespace = "Google\\Cloud\\Spanner\\V1";
|
|
30
|
+
option ruby_package = "Google::Cloud::Spanner::V1";
|
|
31
|
+
|
|
32
|
+
// Options to use for transactions.
|
|
33
|
+
message TransactionOptions {
|
|
34
|
+
// Message type to initiate a read-write transaction. Currently this
|
|
35
|
+
// transaction type has no options.
|
|
36
|
+
message ReadWrite {
|
|
37
|
+
// `ReadLockMode` is used to set the read lock mode for read-write
|
|
38
|
+
// transactions.
|
|
39
|
+
enum ReadLockMode {
|
|
40
|
+
// Default value.
|
|
41
|
+
//
|
|
42
|
+
// * If isolation level is
|
|
43
|
+
// [SERIALIZABLE][google.spanner.v1.TransactionOptions.IsolationLevel.SERIALIZABLE],
|
|
44
|
+
// locking semantics default to `PESSIMISTIC`.
|
|
45
|
+
// * If isolation level is
|
|
46
|
+
// [REPEATABLE_READ][google.spanner.v1.TransactionOptions.IsolationLevel.REPEATABLE_READ],
|
|
47
|
+
// locking semantics default to `OPTIMISTIC`.
|
|
48
|
+
// * See
|
|
49
|
+
// [Concurrency
|
|
50
|
+
// control](https://cloud.google.com/spanner/docs/concurrency-control)
|
|
51
|
+
// for more details.
|
|
52
|
+
READ_LOCK_MODE_UNSPECIFIED = 0;
|
|
53
|
+
|
|
54
|
+
// Pessimistic lock mode.
|
|
55
|
+
//
|
|
56
|
+
// Lock acquisition behavior depends on the isolation level in use. In
|
|
57
|
+
// [SERIALIZABLE][google.spanner.v1.TransactionOptions.IsolationLevel.SERIALIZABLE]
|
|
58
|
+
// isolation, reads and writes acquire necessary locks during transaction
|
|
59
|
+
// statement execution. In
|
|
60
|
+
// [REPEATABLE_READ][google.spanner.v1.TransactionOptions.IsolationLevel.REPEATABLE_READ]
|
|
61
|
+
// isolation, reads that explicitly request to be locked and writes
|
|
62
|
+
// acquire locks.
|
|
63
|
+
// See
|
|
64
|
+
// [Concurrency
|
|
65
|
+
// control](https://cloud.google.com/spanner/docs/concurrency-control) for
|
|
66
|
+
// details on the types of locks acquired at each transaction step.
|
|
67
|
+
PESSIMISTIC = 1;
|
|
68
|
+
|
|
69
|
+
// Optimistic lock mode.
|
|
70
|
+
//
|
|
71
|
+
// Lock acquisition behavior depends on the isolation level in use. In
|
|
72
|
+
// both
|
|
73
|
+
// [SERIALIZABLE][google.spanner.v1.TransactionOptions.IsolationLevel.SERIALIZABLE]
|
|
74
|
+
// and
|
|
75
|
+
// [REPEATABLE_READ][google.spanner.v1.TransactionOptions.IsolationLevel.REPEATABLE_READ]
|
|
76
|
+
// isolation, reads and writes do not acquire locks during transaction
|
|
77
|
+
// statement execution.
|
|
78
|
+
// See
|
|
79
|
+
// [Concurrency
|
|
80
|
+
// control](https://cloud.google.com/spanner/docs/concurrency-control) for
|
|
81
|
+
// details on how the guarantees of each isolation level are provided at
|
|
82
|
+
// commit time.
|
|
83
|
+
OPTIMISTIC = 2;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Read lock mode for the transaction.
|
|
87
|
+
ReadLockMode read_lock_mode = 1;
|
|
88
|
+
|
|
89
|
+
// Optional. Clients should pass the transaction ID of the previous
|
|
90
|
+
// transaction attempt that was aborted if this transaction is being
|
|
91
|
+
// executed on a multiplexed session.
|
|
92
|
+
bytes multiplexed_session_previous_transaction_id = 2
|
|
93
|
+
[(google.api.field_behavior) = OPTIONAL];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Message type to initiate a Partitioned DML transaction.
|
|
97
|
+
message PartitionedDml {}
|
|
98
|
+
|
|
99
|
+
// Message type to initiate a read-only transaction.
|
|
100
|
+
message ReadOnly {
|
|
101
|
+
// How to choose the timestamp for the read-only transaction.
|
|
102
|
+
oneof timestamp_bound {
|
|
103
|
+
// Read at a timestamp where all previously committed transactions
|
|
104
|
+
// are visible.
|
|
105
|
+
bool strong = 1;
|
|
106
|
+
|
|
107
|
+
// Executes all reads at a timestamp >= `min_read_timestamp`.
|
|
108
|
+
//
|
|
109
|
+
// This is useful for requesting fresher data than some previous
|
|
110
|
+
// read, or data that is fresh enough to observe the effects of some
|
|
111
|
+
// previously committed transaction whose timestamp is known.
|
|
112
|
+
//
|
|
113
|
+
// Note that this option can only be used in single-use transactions.
|
|
114
|
+
//
|
|
115
|
+
// A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds.
|
|
116
|
+
// Example: `"2014-10-02T15:01:23.045123456Z"`.
|
|
117
|
+
google.protobuf.Timestamp min_read_timestamp = 2;
|
|
118
|
+
|
|
119
|
+
// Read data at a timestamp >= `NOW - max_staleness`
|
|
120
|
+
// seconds. Guarantees that all writes that have committed more
|
|
121
|
+
// than the specified number of seconds ago are visible. Because
|
|
122
|
+
// Cloud Spanner chooses the exact timestamp, this mode works even if
|
|
123
|
+
// the client's local clock is substantially skewed from Cloud Spanner
|
|
124
|
+
// commit timestamps.
|
|
125
|
+
//
|
|
126
|
+
// Useful for reading the freshest data available at a nearby
|
|
127
|
+
// replica, while bounding the possible staleness if the local
|
|
128
|
+
// replica has fallen behind.
|
|
129
|
+
//
|
|
130
|
+
// Note that this option can only be used in single-use
|
|
131
|
+
// transactions.
|
|
132
|
+
google.protobuf.Duration max_staleness = 3;
|
|
133
|
+
|
|
134
|
+
// Executes all reads at the given timestamp. Unlike other modes,
|
|
135
|
+
// reads at a specific timestamp are repeatable; the same read at
|
|
136
|
+
// the same timestamp always returns the same data. If the
|
|
137
|
+
// timestamp is in the future, the read is blocked until the
|
|
138
|
+
// specified timestamp, modulo the read's deadline.
|
|
139
|
+
//
|
|
140
|
+
// Useful for large scale consistent reads such as mapreduces, or
|
|
141
|
+
// for coordinating many reads against a consistent snapshot of the
|
|
142
|
+
// data.
|
|
143
|
+
//
|
|
144
|
+
// A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds.
|
|
145
|
+
// Example: `"2014-10-02T15:01:23.045123456Z"`.
|
|
146
|
+
google.protobuf.Timestamp read_timestamp = 4;
|
|
147
|
+
|
|
148
|
+
// Executes all reads at a timestamp that is `exact_staleness`
|
|
149
|
+
// old. The timestamp is chosen soon after the read is started.
|
|
150
|
+
//
|
|
151
|
+
// Guarantees that all writes that have committed more than the
|
|
152
|
+
// specified number of seconds ago are visible. Because Cloud Spanner
|
|
153
|
+
// chooses the exact timestamp, this mode works even if the client's
|
|
154
|
+
// local clock is substantially skewed from Cloud Spanner commit
|
|
155
|
+
// timestamps.
|
|
156
|
+
//
|
|
157
|
+
// Useful for reading at nearby replicas without the distributed
|
|
158
|
+
// timestamp negotiation overhead of `max_staleness`.
|
|
159
|
+
google.protobuf.Duration exact_staleness = 5;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// If true, the Cloud Spanner-selected read timestamp is included in
|
|
163
|
+
// the [Transaction][google.spanner.v1.Transaction] message that describes
|
|
164
|
+
// the transaction.
|
|
165
|
+
bool return_read_timestamp = 6;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// `IsolationLevel` is used when setting the [isolation
|
|
169
|
+
// level](https://cloud.google.com/spanner/docs/isolation-levels) for a
|
|
170
|
+
// transaction.
|
|
171
|
+
enum IsolationLevel {
|
|
172
|
+
// Default value.
|
|
173
|
+
//
|
|
174
|
+
// If the value is not specified, the `SERIALIZABLE` isolation level is
|
|
175
|
+
// used.
|
|
176
|
+
ISOLATION_LEVEL_UNSPECIFIED = 0;
|
|
177
|
+
|
|
178
|
+
// All transactions appear as if they executed in a serial order, even if
|
|
179
|
+
// some of the reads, writes, and other operations of distinct transactions
|
|
180
|
+
// actually occurred in parallel. Spanner assigns commit timestamps that
|
|
181
|
+
// reflect the order of committed transactions to implement this property.
|
|
182
|
+
// Spanner offers a stronger guarantee than serializability called external
|
|
183
|
+
// consistency. For more information, see
|
|
184
|
+
// [TrueTime and external
|
|
185
|
+
// consistency](https://cloud.google.com/spanner/docs/true-time-external-consistency#serializability).
|
|
186
|
+
SERIALIZABLE = 1;
|
|
187
|
+
|
|
188
|
+
// All reads performed during the transaction observe a consistent snapshot
|
|
189
|
+
// of the database, and the transaction is only successfully committed in
|
|
190
|
+
// the absence of conflicts between its updates and any concurrent updates
|
|
191
|
+
// that have occurred since that snapshot. Consequently, in contrast to
|
|
192
|
+
// `SERIALIZABLE` transactions, only write-write conflicts are detected in
|
|
193
|
+
// snapshot transactions.
|
|
194
|
+
//
|
|
195
|
+
// This isolation level does not support read-only and partitioned DML
|
|
196
|
+
// transactions.
|
|
197
|
+
//
|
|
198
|
+
// When `REPEATABLE_READ` is specified on a read-write transaction, the
|
|
199
|
+
// locking semantics default to `OPTIMISTIC`.
|
|
200
|
+
REPEATABLE_READ = 2;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Required. The type of transaction.
|
|
204
|
+
oneof mode {
|
|
205
|
+
// Transaction may write.
|
|
206
|
+
//
|
|
207
|
+
// Authorization to begin a read-write transaction requires
|
|
208
|
+
// `spanner.databases.beginOrRollbackReadWriteTransaction` permission
|
|
209
|
+
// on the `session` resource.
|
|
210
|
+
ReadWrite read_write = 1;
|
|
211
|
+
|
|
212
|
+
// Partitioned DML transaction.
|
|
213
|
+
//
|
|
214
|
+
// Authorization to begin a Partitioned DML transaction requires
|
|
215
|
+
// `spanner.databases.beginPartitionedDmlTransaction` permission
|
|
216
|
+
// on the `session` resource.
|
|
217
|
+
PartitionedDml partitioned_dml = 3;
|
|
218
|
+
|
|
219
|
+
// Transaction does not write.
|
|
220
|
+
//
|
|
221
|
+
// Authorization to begin a read-only transaction requires
|
|
222
|
+
// `spanner.databases.beginReadOnlyTransaction` permission
|
|
223
|
+
// on the `session` resource.
|
|
224
|
+
ReadOnly read_only = 2;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// When `exclude_txn_from_change_streams` is set to `true`, it prevents read
|
|
228
|
+
// or write transactions from being tracked in change streams.
|
|
229
|
+
//
|
|
230
|
+
// * If the DDL option `allow_txn_exclusion` is set to `true`, then the
|
|
231
|
+
// updates
|
|
232
|
+
// made within this transaction aren't recorded in the change stream.
|
|
233
|
+
//
|
|
234
|
+
// * If you don't set the DDL option `allow_txn_exclusion` or if it's
|
|
235
|
+
// set to `false`, then the updates made within this transaction are
|
|
236
|
+
// recorded in the change stream.
|
|
237
|
+
//
|
|
238
|
+
// When `exclude_txn_from_change_streams` is set to `false` or not set,
|
|
239
|
+
// modifications from this transaction are recorded in all change streams
|
|
240
|
+
// that are tracking columns modified by these transactions.
|
|
241
|
+
//
|
|
242
|
+
// The `exclude_txn_from_change_streams` option can only be specified
|
|
243
|
+
// for read-write or partitioned DML transactions, otherwise the API returns
|
|
244
|
+
// an `INVALID_ARGUMENT` error.
|
|
245
|
+
bool exclude_txn_from_change_streams = 5;
|
|
246
|
+
|
|
247
|
+
// Isolation level for the transaction.
|
|
248
|
+
IsolationLevel isolation_level = 6;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// A transaction.
|
|
252
|
+
message Transaction {
|
|
253
|
+
// `id` may be used to identify the transaction in subsequent
|
|
254
|
+
// [Read][google.spanner.v1.Spanner.Read],
|
|
255
|
+
// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql],
|
|
256
|
+
// [Commit][google.spanner.v1.Spanner.Commit], or
|
|
257
|
+
// [Rollback][google.spanner.v1.Spanner.Rollback] calls.
|
|
258
|
+
//
|
|
259
|
+
// Single-use read-only transactions do not have IDs, because
|
|
260
|
+
// single-use transactions do not support multiple requests.
|
|
261
|
+
bytes id = 1;
|
|
262
|
+
|
|
263
|
+
// For snapshot read-only transactions, the read timestamp chosen
|
|
264
|
+
// for the transaction. Not returned by default: see
|
|
265
|
+
// [TransactionOptions.ReadOnly.return_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.return_read_timestamp].
|
|
266
|
+
//
|
|
267
|
+
// A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds.
|
|
268
|
+
// Example: `"2014-10-02T15:01:23.045123456Z"`.
|
|
269
|
+
google.protobuf.Timestamp read_timestamp = 2;
|
|
270
|
+
|
|
271
|
+
// A precommit token is included in the response of a BeginTransaction
|
|
272
|
+
// request if the read-write transaction is on a multiplexed session and
|
|
273
|
+
// a mutation_key was specified in the
|
|
274
|
+
// [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
|
|
275
|
+
// The precommit token with the highest sequence number from this transaction
|
|
276
|
+
// attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
|
|
277
|
+
// request for this transaction.
|
|
278
|
+
MultiplexedSessionPrecommitToken precommit_token = 3;
|
|
279
|
+
|
|
280
|
+
// Optional. A cache update expresses a set of changes the client should
|
|
281
|
+
// incorporate into its location cache. The client should discard the changes
|
|
282
|
+
// if they are older than the data it already has. This data can be obtained
|
|
283
|
+
// in response to requests that included a `RoutingHint` field, but may also
|
|
284
|
+
// be obtained by explicit location-fetching RPCs which may be added in the
|
|
285
|
+
// future.
|
|
286
|
+
CacheUpdate cache_update = 5 [(google.api.field_behavior) = OPTIONAL];
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// This message is used to select the transaction in which a
|
|
290
|
+
// [Read][google.spanner.v1.Spanner.Read] or
|
|
291
|
+
// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] call runs.
|
|
292
|
+
//
|
|
293
|
+
// See [TransactionOptions][google.spanner.v1.TransactionOptions] for more
|
|
294
|
+
// information about transactions.
|
|
295
|
+
message TransactionSelector {
|
|
296
|
+
// If no fields are set, the default is a single use transaction
|
|
297
|
+
// with strong concurrency.
|
|
298
|
+
oneof selector {
|
|
299
|
+
// Execute the read or SQL query in a temporary transaction.
|
|
300
|
+
// This is the most efficient way to execute a transaction that
|
|
301
|
+
// consists of a single SQL query.
|
|
302
|
+
TransactionOptions single_use = 1;
|
|
303
|
+
|
|
304
|
+
// Execute the read or SQL query in a previously-started transaction.
|
|
305
|
+
bytes id = 2;
|
|
306
|
+
|
|
307
|
+
// Begin a new transaction and execute this read or SQL query in
|
|
308
|
+
// it. The transaction ID of the new transaction is returned in
|
|
309
|
+
// [ResultSetMetadata.transaction][google.spanner.v1.ResultSetMetadata.transaction],
|
|
310
|
+
// which is a [Transaction][google.spanner.v1.Transaction].
|
|
311
|
+
TransactionOptions begin = 3;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// When a read-write transaction is executed on a multiplexed session,
|
|
316
|
+
// this precommit token is sent back to the client
|
|
317
|
+
// as a part of the [Transaction][google.spanner.v1.Transaction] message in the
|
|
318
|
+
// [BeginTransaction][google.spanner.v1.BeginTransactionRequest] response and
|
|
319
|
+
// also as a part of the [ResultSet][google.spanner.v1.ResultSet] and
|
|
320
|
+
// [PartialResultSet][google.spanner.v1.PartialResultSet] responses.
|
|
321
|
+
message MultiplexedSessionPrecommitToken {
|
|
322
|
+
// Opaque precommit token.
|
|
323
|
+
bytes precommit_token = 1;
|
|
324
|
+
|
|
325
|
+
// An incrementing seq number is generated on every precommit token
|
|
326
|
+
// that is returned. Clients should remember the precommit token with the
|
|
327
|
+
// highest sequence number from the current transaction attempt.
|
|
328
|
+
int32 seq_num = 2;
|
|
329
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
// Copyright 2026 Google LLC
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
syntax = "proto3";
|
|
16
|
+
|
|
17
|
+
package google.spanner.v1;
|
|
18
|
+
|
|
19
|
+
import "google/api/field_behavior.proto";
|
|
20
|
+
|
|
21
|
+
option csharp_namespace = "Google.Cloud.Spanner.V1";
|
|
22
|
+
option go_package = "cloud.google.com/go/spanner/apiv1/spannerpb;spannerpb";
|
|
23
|
+
option java_multiple_files = true;
|
|
24
|
+
option java_outer_classname = "TypeProto";
|
|
25
|
+
option java_package = "com.google.spanner.v1";
|
|
26
|
+
option php_namespace = "Google\\Cloud\\Spanner\\V1";
|
|
27
|
+
option ruby_package = "Google::Cloud::Spanner::V1";
|
|
28
|
+
|
|
29
|
+
// `Type` indicates the type of a Cloud Spanner value, as might be stored in a
|
|
30
|
+
// table cell or returned from an SQL query.
|
|
31
|
+
message Type {
|
|
32
|
+
// Required. The [TypeCode][google.spanner.v1.TypeCode] for this type.
|
|
33
|
+
TypeCode code = 1 [(google.api.field_behavior) = REQUIRED];
|
|
34
|
+
|
|
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.
|
|
38
|
+
Type array_element_type = 2;
|
|
39
|
+
|
|
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.
|
|
43
|
+
StructType struct_type = 3;
|
|
44
|
+
|
|
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.
|
|
53
|
+
TypeAnnotationCode type_annotation = 4;
|
|
54
|
+
|
|
55
|
+
// If [code][google.spanner.v1.Type.code] ==
|
|
56
|
+
// [PROTO][google.spanner.v1.TypeCode.PROTO] or
|
|
57
|
+
// [code][google.spanner.v1.Type.code] ==
|
|
58
|
+
// [ENUM][google.spanner.v1.TypeCode.ENUM], then `proto_type_fqn` is the fully
|
|
59
|
+
// qualified name of the proto type representing the proto/enum definition.
|
|
60
|
+
string proto_type_fqn = 5;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// `StructType` defines the fields of a
|
|
64
|
+
// [STRUCT][google.spanner.v1.TypeCode.STRUCT] type.
|
|
65
|
+
message StructType {
|
|
66
|
+
// Message representing a single field of a struct.
|
|
67
|
+
message Field {
|
|
68
|
+
// The name of the field. For reads, this is the column name. For
|
|
69
|
+
// SQL queries, it is the column alias (e.g., `"Word"` in the
|
|
70
|
+
// query `"SELECT 'hello' AS Word"`), or the column name (e.g.,
|
|
71
|
+
// `"ColName"` in the query `"SELECT ColName FROM Table"`). Some
|
|
72
|
+
// columns might have an empty name (e.g., `"SELECT
|
|
73
|
+
// UPPER(ColName)"`). Note that a query result can contain
|
|
74
|
+
// multiple fields with the same name.
|
|
75
|
+
string name = 1;
|
|
76
|
+
|
|
77
|
+
// The type of the field.
|
|
78
|
+
Type type = 2;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// The list of fields that make up this struct. Order is
|
|
82
|
+
// significant, because values of this struct type are represented as
|
|
83
|
+
// lists, where the order of field values matches the order of
|
|
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.
|
|
87
|
+
repeated Field fields = 1;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// `TypeCode` is used as part of [Type][google.spanner.v1.Type] to
|
|
91
|
+
// indicate the type of a Cloud Spanner value.
|
|
92
|
+
//
|
|
93
|
+
// Each legal value of a type can be encoded to or decoded from a JSON
|
|
94
|
+
// value, using the encodings described below. All Cloud Spanner values can
|
|
95
|
+
// be `null`, regardless of type; `null`s are always encoded as a JSON
|
|
96
|
+
// `null`.
|
|
97
|
+
enum TypeCode {
|
|
98
|
+
// Not specified.
|
|
99
|
+
TYPE_CODE_UNSPECIFIED = 0;
|
|
100
|
+
|
|
101
|
+
// Encoded as JSON `true` or `false`.
|
|
102
|
+
BOOL = 1;
|
|
103
|
+
|
|
104
|
+
// Encoded as `string`, in decimal format.
|
|
105
|
+
INT64 = 2;
|
|
106
|
+
|
|
107
|
+
// Encoded as `number`, or the strings `"NaN"`, `"Infinity"`, or
|
|
108
|
+
// `"-Infinity"`.
|
|
109
|
+
FLOAT64 = 3;
|
|
110
|
+
|
|
111
|
+
// Encoded as `number`, or the strings `"NaN"`, `"Infinity"`, or
|
|
112
|
+
// `"-Infinity"`.
|
|
113
|
+
FLOAT32 = 15;
|
|
114
|
+
|
|
115
|
+
// Encoded as `string` in RFC 3339 timestamp format. The time zone
|
|
116
|
+
// must be present, and must be `"Z"`.
|
|
117
|
+
//
|
|
118
|
+
// If the schema has the column option
|
|
119
|
+
// `allow_commit_timestamp=true`, the placeholder string
|
|
120
|
+
// `"spanner.commit_timestamp()"` can be used to instruct the system
|
|
121
|
+
// to insert the commit timestamp associated with the transaction
|
|
122
|
+
// commit.
|
|
123
|
+
TIMESTAMP = 4;
|
|
124
|
+
|
|
125
|
+
// Encoded as `string` in RFC 3339 date format.
|
|
126
|
+
DATE = 5;
|
|
127
|
+
|
|
128
|
+
// Encoded as `string`.
|
|
129
|
+
STRING = 6;
|
|
130
|
+
|
|
131
|
+
// Encoded as a base64-encoded `string`, as described in RFC 4648,
|
|
132
|
+
// section 4.
|
|
133
|
+
BYTES = 7;
|
|
134
|
+
|
|
135
|
+
// Encoded as `list`, where the list elements are represented
|
|
136
|
+
// according to
|
|
137
|
+
// [array_element_type][google.spanner.v1.Type.array_element_type].
|
|
138
|
+
ARRAY = 8;
|
|
139
|
+
|
|
140
|
+
// Encoded as `list`, where list element `i` is represented according
|
|
141
|
+
// to [struct_type.fields[i]][google.spanner.v1.StructType.fields].
|
|
142
|
+
STRUCT = 9;
|
|
143
|
+
|
|
144
|
+
// Encoded as `string`, in decimal format or scientific notation format.
|
|
145
|
+
// Decimal format:
|
|
146
|
+
// `[+-]Digits[.[Digits]]` or
|
|
147
|
+
// `[+-][Digits].Digits`
|
|
148
|
+
//
|
|
149
|
+
// Scientific notation:
|
|
150
|
+
// `[+-]Digits[.[Digits]][ExponentIndicator[+-]Digits]` or
|
|
151
|
+
// `[+-][Digits].Digits[ExponentIndicator[+-]Digits]`
|
|
152
|
+
// (ExponentIndicator is `"e"` or `"E"`)
|
|
153
|
+
NUMERIC = 10;
|
|
154
|
+
|
|
155
|
+
// Encoded as a JSON-formatted `string` as described in RFC 7159. The
|
|
156
|
+
// following rules are applied when parsing JSON input:
|
|
157
|
+
//
|
|
158
|
+
// - Whitespace characters are not preserved.
|
|
159
|
+
// - If a JSON object has duplicate keys, only the first key is preserved.
|
|
160
|
+
// - Members of a JSON object are not guaranteed to have their order
|
|
161
|
+
// preserved.
|
|
162
|
+
// - JSON array elements will have their order preserved.
|
|
163
|
+
JSON = 11;
|
|
164
|
+
|
|
165
|
+
// Encoded as a base64-encoded `string`, as described in RFC 4648,
|
|
166
|
+
// section 4.
|
|
167
|
+
PROTO = 13;
|
|
168
|
+
|
|
169
|
+
// Encoded as `string`, in decimal format.
|
|
170
|
+
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;
|
|
178
|
+
|
|
179
|
+
// Encoded as `string`, in lower-case hexa-decimal format, as described
|
|
180
|
+
// in RFC 9562, section 4.
|
|
181
|
+
UUID = 17;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// `TypeAnnotationCode` is used as a part of [Type][google.spanner.v1.Type] to
|
|
185
|
+
// disambiguate SQL types that should be used for a given Cloud Spanner value.
|
|
186
|
+
// Disambiguation is needed because the same Cloud Spanner type can be mapped to
|
|
187
|
+
// different SQL types depending on SQL dialect. TypeAnnotationCode doesn't
|
|
188
|
+
// affect the way value is serialized.
|
|
189
|
+
enum TypeAnnotationCode {
|
|
190
|
+
// Not specified.
|
|
191
|
+
TYPE_ANNOTATION_CODE_UNSPECIFIED = 0;
|
|
192
|
+
|
|
193
|
+
// PostgreSQL compatible NUMERIC type. This annotation needs to be applied to
|
|
194
|
+
// [Type][google.spanner.v1.Type] instances having
|
|
195
|
+
// [NUMERIC][google.spanner.v1.TypeCode.NUMERIC] type code to specify that
|
|
196
|
+
// values of this type should be treated as PostgreSQL NUMERIC values.
|
|
197
|
+
// Currently this annotation is always needed for
|
|
198
|
+
// [NUMERIC][google.spanner.v1.TypeCode.NUMERIC] when a client interacts with
|
|
199
|
+
// PostgreSQL-enabled Spanner databases.
|
|
200
|
+
PG_NUMERIC = 2;
|
|
201
|
+
|
|
202
|
+
// PostgreSQL compatible JSONB type. This annotation needs to be applied to
|
|
203
|
+
// [Type][google.spanner.v1.Type] instances having
|
|
204
|
+
// [JSON][google.spanner.v1.TypeCode.JSON] type code to specify that values of
|
|
205
|
+
// this type should be treated as PostgreSQL JSONB values. Currently this
|
|
206
|
+
// annotation is always needed for [JSON][google.spanner.v1.TypeCode.JSON]
|
|
207
|
+
// when a client interacts with PostgreSQL-enabled Spanner databases.
|
|
208
|
+
PG_JSONB = 3;
|
|
209
|
+
|
|
210
|
+
// PostgreSQL compatible OID type. This annotation can be used by a client
|
|
211
|
+
// interacting with PostgreSQL-enabled Spanner database to specify that a
|
|
212
|
+
// value should be treated using the semantics of the OID type.
|
|
213
|
+
PG_OID = 4;
|
|
214
|
+
}
|