google-cloud-spanner 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/google-cloud-spanner.rb +106 -0
- data/lib/google/cloud/spanner.rb +382 -0
- data/lib/google/cloud/spanner/admin/database/v1.rb +17 -0
- data/lib/google/cloud/spanner/admin/database/v1/database_admin_client.rb +703 -0
- data/lib/google/cloud/spanner/admin/database/v1/database_admin_client_config.json +73 -0
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/policy.rb +139 -0
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/any.rb +114 -0
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/rpc/status.rb +83 -0
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/spanner/admin/database/v1/spanner_database_admin.rb +188 -0
- data/lib/google/cloud/spanner/admin/instance/v1.rb +17 -0
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/policy.rb +139 -0
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/any.rb +114 -0
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/field_mask.rb +223 -0
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/rpc/status.rb +83 -0
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/spanner/admin/instance/v1/spanner_instance_admin.rb +268 -0
- data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client.rb +868 -0
- data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client_config.json +78 -0
- data/lib/google/cloud/spanner/client.rb +1034 -0
- data/lib/google/cloud/spanner/commit.rb +351 -0
- data/lib/google/cloud/spanner/convert.rb +311 -0
- data/lib/google/cloud/spanner/credentials.rb +32 -0
- data/lib/google/cloud/spanner/data.rb +199 -0
- data/lib/google/cloud/spanner/database.rb +377 -0
- data/lib/google/cloud/spanner/database/job.rb +179 -0
- data/lib/google/cloud/spanner/database/list.rb +171 -0
- data/lib/google/cloud/spanner/errors.rb +73 -0
- data/lib/google/cloud/spanner/fields.rb +252 -0
- data/lib/google/cloud/spanner/instance.rb +472 -0
- data/lib/google/cloud/spanner/instance/config.rb +99 -0
- data/lib/google/cloud/spanner/instance/config/list.rb +171 -0
- data/lib/google/cloud/spanner/instance/job.rb +197 -0
- data/lib/google/cloud/spanner/instance/list.rb +167 -0
- data/lib/google/cloud/spanner/policy.rb +201 -0
- data/lib/google/cloud/spanner/pool.rb +279 -0
- data/lib/google/cloud/spanner/project.rb +480 -0
- data/lib/google/cloud/spanner/range.rb +99 -0
- data/lib/google/cloud/spanner/results.rb +280 -0
- data/lib/google/cloud/spanner/service.rb +458 -0
- data/lib/google/cloud/spanner/session.rb +565 -0
- data/lib/google/cloud/spanner/snapshot.rb +260 -0
- data/lib/google/cloud/spanner/transaction.rb +533 -0
- data/lib/google/cloud/spanner/v1.rb +17 -0
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/duration.rb +77 -0
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/struct.rb +73 -0
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/timestamp.rb +81 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/keys.rb +148 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/mutation.rb +80 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/query_plan.rb +120 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/result_set.rb +175 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/spanner.rb +206 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/transaction.rb +351 -0
- data/lib/google/cloud/spanner/v1/spanner_client.rb +850 -0
- data/lib/google/cloud/spanner/v1/spanner_client_config.json +78 -0
- data/lib/google/cloud/spanner/version.rb +22 -0
- data/lib/google/spanner/admin/database/v1/spanner_database_admin_pb.rb +85 -0
- data/lib/google/spanner/admin/database/v1/spanner_database_admin_services_pb.rb +95 -0
- data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_pb.rb +106 -0
- data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_services_pb.rb +180 -0
- data/lib/google/spanner/v1/keys_pb.rb +33 -0
- data/lib/google/spanner/v1/mutation_pb.rb +38 -0
- data/lib/google/spanner/v1/query_plan_pb.rb +47 -0
- data/lib/google/spanner/v1/result_set_pb.rb +43 -0
- data/lib/google/spanner/v1/spanner_pb.rb +90 -0
- data/lib/google/spanner/v1/spanner_services_pb.rb +131 -0
- data/lib/google/spanner/v1/transaction_pb.rb +51 -0
- data/lib/google/spanner/v1/type_pb.rb +43 -0
- metadata +309 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
# Copyright 2016 Google Inc. All rights reserved.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
|
17
|
+
require "google/cloud/spanner/v1/spanner_client"
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# Copyright 2017, Google Inc. All rights reserved.
|
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
|
+
module Google
|
16
|
+
module Protobuf
|
17
|
+
# A Duration represents a signed, fixed-length span of time represented
|
18
|
+
# as a count of seconds and fractions of seconds at nanosecond
|
19
|
+
# resolution. It is independent of any calendar and concepts like "day"
|
20
|
+
# or "month". It is related to Timestamp in that the difference between
|
21
|
+
# two Timestamp values is a Duration and it can be added or subtracted
|
22
|
+
# from a Timestamp. Range is approximately +-10,000 years.
|
23
|
+
#
|
24
|
+
# Example 1: Compute Duration from two Timestamps in pseudo code.
|
25
|
+
#
|
26
|
+
# Timestamp start = ...;
|
27
|
+
# Timestamp end = ...;
|
28
|
+
# Duration duration = ...;
|
29
|
+
#
|
30
|
+
# duration.seconds = end.seconds - start.seconds;
|
31
|
+
# duration.nanos = end.nanos - start.nanos;
|
32
|
+
#
|
33
|
+
# if (duration.seconds < 0 && duration.nanos > 0) {
|
34
|
+
# duration.seconds += 1;
|
35
|
+
# duration.nanos -= 1000000000;
|
36
|
+
# } else if (durations.seconds > 0 && duration.nanos < 0) {
|
37
|
+
# duration.seconds -= 1;
|
38
|
+
# duration.nanos += 1000000000;
|
39
|
+
# }
|
40
|
+
#
|
41
|
+
# Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
|
42
|
+
#
|
43
|
+
# Timestamp start = ...;
|
44
|
+
# Duration duration = ...;
|
45
|
+
# Timestamp end = ...;
|
46
|
+
#
|
47
|
+
# end.seconds = start.seconds + duration.seconds;
|
48
|
+
# end.nanos = start.nanos + duration.nanos;
|
49
|
+
#
|
50
|
+
# if (end.nanos < 0) {
|
51
|
+
# end.seconds -= 1;
|
52
|
+
# end.nanos += 1000000000;
|
53
|
+
# } else if (end.nanos >= 1000000000) {
|
54
|
+
# end.seconds += 1;
|
55
|
+
# end.nanos -= 1000000000;
|
56
|
+
# }
|
57
|
+
#
|
58
|
+
# Example 3: Compute Duration from datetime.timedelta in Python.
|
59
|
+
#
|
60
|
+
# td = datetime.timedelta(days=3, minutes=10)
|
61
|
+
# duration = Duration()
|
62
|
+
# duration.FromTimedelta(td)
|
63
|
+
# @!attribute [rw] seconds
|
64
|
+
# @return [Integer]
|
65
|
+
# Signed seconds of the span of time. Must be from -315,576,000,000
|
66
|
+
# to +315,576,000,000 inclusive.
|
67
|
+
# @!attribute [rw] nanos
|
68
|
+
# @return [Integer]
|
69
|
+
# Signed fractions of a second at nanosecond resolution of the span
|
70
|
+
# of time. Durations less than one second are represented with a 0
|
71
|
+
# +seconds+ field and a positive or negative +nanos+ field. For durations
|
72
|
+
# of one second or more, a non-zero value for the +nanos+ field must be
|
73
|
+
# of the same sign as the +seconds+ field. Must be from -999,999,999
|
74
|
+
# to +999,999,999 inclusive.
|
75
|
+
class Duration; end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# Copyright 2017, Google Inc. All rights reserved.
|
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
|
+
module Google
|
16
|
+
module Protobuf
|
17
|
+
# +Struct+ represents a structured data value, consisting of fields
|
18
|
+
# which map to dynamically typed values. In some languages, +Struct+
|
19
|
+
# might be supported by a native representation. For example, in
|
20
|
+
# scripting languages like JS a struct is represented as an
|
21
|
+
# object. The details of that representation are described together
|
22
|
+
# with the proto support for the language.
|
23
|
+
#
|
24
|
+
# The JSON representation for +Struct+ is JSON object.
|
25
|
+
# @!attribute [rw] fields
|
26
|
+
# @return [Hash{String => Google::Protobuf::Value}]
|
27
|
+
# Unordered map of dynamically typed values.
|
28
|
+
class Struct; end
|
29
|
+
|
30
|
+
# +Value+ represents a dynamically typed value which can be either
|
31
|
+
# null, a number, a string, a boolean, a recursive struct value, or a
|
32
|
+
# list of values. A producer of value is expected to set one of that
|
33
|
+
# variants, absence of any variant indicates an error.
|
34
|
+
#
|
35
|
+
# The JSON representation for +Value+ is JSON value.
|
36
|
+
# @!attribute [rw] null_value
|
37
|
+
# @return [Google::Protobuf::NullValue]
|
38
|
+
# Represents a null value.
|
39
|
+
# @!attribute [rw] number_value
|
40
|
+
# @return [Float]
|
41
|
+
# Represents a double value.
|
42
|
+
# @!attribute [rw] string_value
|
43
|
+
# @return [String]
|
44
|
+
# Represents a string value.
|
45
|
+
# @!attribute [rw] bool_value
|
46
|
+
# @return [true, false]
|
47
|
+
# Represents a boolean value.
|
48
|
+
# @!attribute [rw] struct_value
|
49
|
+
# @return [Google::Protobuf::Struct]
|
50
|
+
# Represents a structured value.
|
51
|
+
# @!attribute [rw] list_value
|
52
|
+
# @return [Google::Protobuf::ListValue]
|
53
|
+
# Represents a repeated +Value+.
|
54
|
+
class Value; end
|
55
|
+
|
56
|
+
# +ListValue+ is a wrapper around a repeated field of values.
|
57
|
+
#
|
58
|
+
# The JSON representation for +ListValue+ is JSON array.
|
59
|
+
# @!attribute [rw] values
|
60
|
+
# @return [Array<Google::Protobuf::Value>]
|
61
|
+
# Repeated field of dynamically typed values.
|
62
|
+
class ListValue; end
|
63
|
+
|
64
|
+
# +NullValue+ is a singleton enumeration to represent the null value for the
|
65
|
+
# +Value+ type union.
|
66
|
+
#
|
67
|
+
# The JSON representation for +NullValue+ is JSON +null+.
|
68
|
+
module NullValue
|
69
|
+
# Null value.
|
70
|
+
NULL_VALUE = 0
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# Copyright 2017, Google Inc. All rights reserved.
|
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
|
+
module Google
|
16
|
+
module Protobuf
|
17
|
+
# A Timestamp represents a point in time independent of any time zone
|
18
|
+
# or calendar, represented as seconds and fractions of seconds at
|
19
|
+
# nanosecond resolution in UTC Epoch time. It is encoded using the
|
20
|
+
# Proleptic Gregorian Calendar which extends the Gregorian calendar
|
21
|
+
# backwards to year one. It is encoded assuming all minutes are 60
|
22
|
+
# seconds long, i.e. leap seconds are "smeared" so that no leap second
|
23
|
+
# table is needed for interpretation. Range is from
|
24
|
+
# 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
|
25
|
+
# By restricting to that range, we ensure that we can convert to
|
26
|
+
# and from RFC 3339 date strings.
|
27
|
+
# See {https://www.ietf.org/rfc/rfc3339.txt}[https://www.ietf.org/rfc/rfc3339.txt].
|
28
|
+
#
|
29
|
+
# Example 1: Compute Timestamp from POSIX +time()+.
|
30
|
+
#
|
31
|
+
# Timestamp timestamp;
|
32
|
+
# timestamp.set_seconds(time(NULL));
|
33
|
+
# timestamp.set_nanos(0);
|
34
|
+
#
|
35
|
+
# Example 2: Compute Timestamp from POSIX +gettimeofday()+.
|
36
|
+
#
|
37
|
+
# struct timeval tv;
|
38
|
+
# gettimeofday(&tv, NULL);
|
39
|
+
#
|
40
|
+
# Timestamp timestamp;
|
41
|
+
# timestamp.set_seconds(tv.tv_sec);
|
42
|
+
# timestamp.set_nanos(tv.tv_usec * 1000);
|
43
|
+
#
|
44
|
+
# Example 3: Compute Timestamp from Win32 +GetSystemTimeAsFileTime()+.
|
45
|
+
#
|
46
|
+
# FILETIME ft;
|
47
|
+
# GetSystemTimeAsFileTime(&ft);
|
48
|
+
# UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
49
|
+
#
|
50
|
+
# // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
51
|
+
# // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
52
|
+
# Timestamp timestamp;
|
53
|
+
# timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
54
|
+
# timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
55
|
+
#
|
56
|
+
# Example 4: Compute Timestamp from Java +System.currentTimeMillis()+.
|
57
|
+
#
|
58
|
+
# long millis = System.currentTimeMillis();
|
59
|
+
#
|
60
|
+
# Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
61
|
+
# .setNanos((int) ((millis % 1000) * 1000000)).build();
|
62
|
+
#
|
63
|
+
#
|
64
|
+
# Example 5: Compute Timestamp from current time in Python.
|
65
|
+
#
|
66
|
+
# timestamp = Timestamp()
|
67
|
+
# timestamp.GetCurrentTime()
|
68
|
+
# @!attribute [rw] seconds
|
69
|
+
# @return [Integer]
|
70
|
+
# Represents seconds of UTC time since Unix epoch
|
71
|
+
# 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
72
|
+
# 9999-12-31T23:59:59Z inclusive.
|
73
|
+
# @!attribute [rw] nanos
|
74
|
+
# @return [Integer]
|
75
|
+
# Non-negative fractions of a second at nanosecond resolution. Negative
|
76
|
+
# second values with fractions must still have non-negative nanos values
|
77
|
+
# that count forward in time. Must be from 0 to 999,999,999
|
78
|
+
# inclusive.
|
79
|
+
class Timestamp; end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,148 @@
|
|
1
|
+
# Copyright 2017, Google Inc. All rights reserved.
|
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
|
+
module Google
|
16
|
+
module Spanner
|
17
|
+
module V1
|
18
|
+
# KeyRange represents a range of rows in a table or index.
|
19
|
+
#
|
20
|
+
# A range has a start key and an end key. These keys can be open or
|
21
|
+
# closed, indicating if the range includes rows with that key.
|
22
|
+
#
|
23
|
+
# Keys are represented by lists, where the ith value in the list
|
24
|
+
# corresponds to the ith component of the table or index primary key.
|
25
|
+
# Individual values are encoded as described Here.
|
26
|
+
#
|
27
|
+
# For example, consider the following table definition:
|
28
|
+
#
|
29
|
+
# CREATE TABLE UserEvents (
|
30
|
+
# UserName STRING(MAX),
|
31
|
+
# EventDate STRING(10)
|
32
|
+
# ) PRIMARY KEY(UserName, EventDate);
|
33
|
+
#
|
34
|
+
# The following keys name rows in this table:
|
35
|
+
#
|
36
|
+
# ["Bob", "2014-09-23"]
|
37
|
+
# ["Alfred", "2015-06-12"]
|
38
|
+
#
|
39
|
+
# Since the +UserEvents+ table's +PRIMARY KEY+ clause names two
|
40
|
+
# columns, each +UserEvents+ key has two elements; the first is the
|
41
|
+
# +UserName+, and the second is the +EventDate+.
|
42
|
+
#
|
43
|
+
# Key ranges with multiple components are interpreted
|
44
|
+
# lexicographically by component using the table or index key's declared
|
45
|
+
# sort order. For example, the following range returns all events for
|
46
|
+
# user +"Bob"+ that occurred in the year 2015:
|
47
|
+
#
|
48
|
+
# "start_closed": ["Bob", "2015-01-01"]
|
49
|
+
# "end_closed": ["Bob", "2015-12-31"]
|
50
|
+
#
|
51
|
+
# Start and end keys can omit trailing key components. This affects the
|
52
|
+
# inclusion and exclusion of rows that exactly match the provided key
|
53
|
+
# components: if the key is closed, then rows that exactly match the
|
54
|
+
# provided components are included; if the key is open, then rows
|
55
|
+
# that exactly match are not included.
|
56
|
+
#
|
57
|
+
# For example, the following range includes all events for +"Bob"+ that
|
58
|
+
# occurred during and after the year 2000:
|
59
|
+
#
|
60
|
+
# "start_closed": ["Bob", "2000-01-01"]
|
61
|
+
# "end_closed": ["Bob"]
|
62
|
+
#
|
63
|
+
# The next example retrieves all events for +"Bob"+:
|
64
|
+
#
|
65
|
+
# "start_closed": ["Bob"]
|
66
|
+
# "end_closed": ["Bob"]
|
67
|
+
#
|
68
|
+
# To retrieve events before the year 2000:
|
69
|
+
#
|
70
|
+
# "start_closed": ["Bob"]
|
71
|
+
# "end_open": ["Bob", "2000-01-01"]
|
72
|
+
#
|
73
|
+
# The following range includes all rows in the table:
|
74
|
+
#
|
75
|
+
# "start_closed": []
|
76
|
+
# "end_closed": []
|
77
|
+
#
|
78
|
+
# This range returns all users whose +UserName+ begins with any
|
79
|
+
# character from A to C:
|
80
|
+
#
|
81
|
+
# "start_closed": ["A"]
|
82
|
+
# "end_open": ["D"]
|
83
|
+
#
|
84
|
+
# This range returns all users whose +UserName+ begins with B:
|
85
|
+
#
|
86
|
+
# "start_closed": ["B"]
|
87
|
+
# "end_open": ["C"]
|
88
|
+
#
|
89
|
+
# Key ranges honor column sort order. For example, suppose a table is
|
90
|
+
# defined as follows:
|
91
|
+
#
|
92
|
+
# CREATE TABLE DescendingSortedTable {
|
93
|
+
# Key INT64,
|
94
|
+
# ...
|
95
|
+
# ) PRIMARY KEY(Key DESC);
|
96
|
+
#
|
97
|
+
# The following range retrieves all rows with key values between 1
|
98
|
+
# and 100 inclusive:
|
99
|
+
#
|
100
|
+
# "start_closed": ["100"]
|
101
|
+
# "end_closed": ["1"]
|
102
|
+
#
|
103
|
+
# Note that 100 is passed as the start, and 1 is passed as the end,
|
104
|
+
# because +Key+ is a descending column in the schema.
|
105
|
+
# @!attribute [rw] start_closed
|
106
|
+
# @return [Google::Protobuf::ListValue]
|
107
|
+
# If the start is closed, then the range includes all rows whose
|
108
|
+
# first +len(start_closed)+ key columns exactly match +start_closed+.
|
109
|
+
# @!attribute [rw] start_open
|
110
|
+
# @return [Google::Protobuf::ListValue]
|
111
|
+
# If the start is open, then the range excludes rows whose first
|
112
|
+
# +len(start_open)+ key columns exactly match +start_open+.
|
113
|
+
# @!attribute [rw] end_closed
|
114
|
+
# @return [Google::Protobuf::ListValue]
|
115
|
+
# If the end is closed, then the range includes all rows whose
|
116
|
+
# first +len(end_closed)+ key columns exactly match +end_closed+.
|
117
|
+
# @!attribute [rw] end_open
|
118
|
+
# @return [Google::Protobuf::ListValue]
|
119
|
+
# If the end is open, then the range excludes rows whose first
|
120
|
+
# +len(end_open)+ key columns exactly match +end_open+.
|
121
|
+
class KeyRange; end
|
122
|
+
|
123
|
+
# +KeySet+ defines a collection of Cloud Spanner keys and/or key ranges. All
|
124
|
+
# the keys are expected to be in the same table or index. The keys need
|
125
|
+
# not be sorted in any particular way.
|
126
|
+
#
|
127
|
+
# If the same key is specified multiple times in the set (for example
|
128
|
+
# if two ranges, two keys, or a key and a range overlap), Cloud Spanner
|
129
|
+
# behaves as if the key were only specified once.
|
130
|
+
# @!attribute [rw] keys
|
131
|
+
# @return [Array<Google::Protobuf::ListValue>]
|
132
|
+
# A list of specific keys. Entries in +keys+ should have exactly as
|
133
|
+
# many elements as there are columns in the primary or index key
|
134
|
+
# with which this +KeySet+ is used. Individual key values are
|
135
|
+
# encoded as described Here.
|
136
|
+
# @!attribute [rw] ranges
|
137
|
+
# @return [Array<Google::Spanner::V1::KeyRange>]
|
138
|
+
# A list of key ranges. See KeyRange for more information about
|
139
|
+
# key range specifications.
|
140
|
+
# @!attribute [rw] all
|
141
|
+
# @return [true, false]
|
142
|
+
# For convenience +all+ can be set to +true+ to indicate that this
|
143
|
+
# +KeySet+ matches all keys in the table or index. Note that any keys
|
144
|
+
# specified in +keys+ or +ranges+ are only yielded once.
|
145
|
+
class KeySet; end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# Copyright 2017, Google Inc. All rights reserved.
|
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
|
+
module Google
|
16
|
+
module Spanner
|
17
|
+
module V1
|
18
|
+
# A modification to one or more Cloud Spanner rows. Mutations can be
|
19
|
+
# applied to a Cloud Spanner database by sending them in a
|
20
|
+
# Commit call.
|
21
|
+
# @!attribute [rw] insert
|
22
|
+
# @return [Google::Spanner::V1::Mutation::Write]
|
23
|
+
# Insert new rows in a table. If any of the rows already exist,
|
24
|
+
# the write or transaction fails with error +ALREADY_EXISTS+.
|
25
|
+
# @!attribute [rw] update
|
26
|
+
# @return [Google::Spanner::V1::Mutation::Write]
|
27
|
+
# Update existing rows in a table. If any of the rows does not
|
28
|
+
# already exist, the transaction fails with error +NOT_FOUND+.
|
29
|
+
# @!attribute [rw] insert_or_update
|
30
|
+
# @return [Google::Spanner::V1::Mutation::Write]
|
31
|
+
# Like Insert, except that if the row already exists, then
|
32
|
+
# its column values are overwritten with the ones provided. Any
|
33
|
+
# column values not explicitly written are preserved.
|
34
|
+
# @!attribute [rw] replace
|
35
|
+
# @return [Google::Spanner::V1::Mutation::Write]
|
36
|
+
# Like Insert, except that if the row already exists, it is
|
37
|
+
# deleted, and the column values provided are inserted
|
38
|
+
# instead. Unlike Insert_or_update, this means any values not
|
39
|
+
# explicitly written become +NULL+.
|
40
|
+
# @!attribute [rw] delete
|
41
|
+
# @return [Google::Spanner::V1::Mutation::Delete]
|
42
|
+
# Delete rows from a table. Succeeds whether or not the named
|
43
|
+
# rows were present.
|
44
|
+
class Mutation
|
45
|
+
# Arguments to Insert, Update, Insert_or_update, and
|
46
|
+
# Replace operations.
|
47
|
+
# @!attribute [rw] table
|
48
|
+
# @return [String]
|
49
|
+
# Required. The table whose rows will be written.
|
50
|
+
# @!attribute [rw] columns
|
51
|
+
# @return [Array<String>]
|
52
|
+
# The names of the columns in Table to be written.
|
53
|
+
#
|
54
|
+
# The list of columns must contain enough columns to allow
|
55
|
+
# Cloud Spanner to derive values for all primary key columns in the
|
56
|
+
# row(s) to be modified.
|
57
|
+
# @!attribute [rw] values
|
58
|
+
# @return [Array<Google::Protobuf::ListValue>]
|
59
|
+
# The values to be written. +values+ can contain more than one
|
60
|
+
# list of values. If it does, then multiple rows are written, one
|
61
|
+
# for each entry in +values+. Each list in +values+ must have
|
62
|
+
# exactly as many entries as there are entries in Columns
|
63
|
+
# above. Sending multiple lists is equivalent to sending multiple
|
64
|
+
# +Mutation+s, each containing one +values+ entry and repeating
|
65
|
+
# Table and Columns. Individual values in each list are
|
66
|
+
# encoded as described Here.
|
67
|
+
class Write; end
|
68
|
+
|
69
|
+
# Arguments to Delete operations.
|
70
|
+
# @!attribute [rw] table
|
71
|
+
# @return [String]
|
72
|
+
# Required. The table whose rows will be deleted.
|
73
|
+
# @!attribute [rw] key_set
|
74
|
+
# @return [Google::Spanner::V1::KeySet]
|
75
|
+
# Required. The primary keys of the rows within Table to delete.
|
76
|
+
class Delete; end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|