google-cloud-datastore 1.8.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +2 -1
  3. data/CHANGELOG.md +23 -0
  4. data/lib/google-cloud-datastore.rb +12 -18
  5. data/lib/google/cloud/datastore.rb +12 -11
  6. data/lib/google/cloud/datastore/commit.rb +4 -4
  7. data/lib/google/cloud/datastore/convert.rb +4 -4
  8. data/lib/google/cloud/datastore/credentials.rb +2 -2
  9. data/lib/google/cloud/datastore/entity.rb +3 -3
  10. data/lib/google/cloud/datastore/gql_query.rb +5 -5
  11. data/lib/google/cloud/datastore/key.rb +5 -5
  12. data/lib/google/cloud/datastore/properties.rb +1 -1
  13. data/lib/google/cloud/datastore/query.rb +12 -12
  14. data/lib/google/cloud/datastore/service.rb +31 -86
  15. data/lib/google/cloud/datastore/version.rb +1 -1
  16. metadata +8 -63
  17. data/lib/google/cloud/datastore/v1.rb +0 -16
  18. data/lib/google/cloud/datastore/v1/credentials.rb +0 -39
  19. data/lib/google/cloud/datastore/v1/datastore_client.rb +0 -577
  20. data/lib/google/cloud/datastore/v1/datastore_client_config.json +0 -61
  21. data/lib/google/cloud/datastore/v1/doc/google/datastore/v1/datastore.rb +0 -283
  22. data/lib/google/cloud/datastore/v1/doc/google/datastore/v1/entity.rb +0 -189
  23. data/lib/google/cloud/datastore/v1/doc/google/datastore/v1/query.rb +0 -297
  24. data/lib/google/cloud/datastore/v1/doc/google/protobuf/struct.rb +0 -74
  25. data/lib/google/cloud/datastore/v1/doc/google/protobuf/timestamp.rb +0 -109
  26. data/lib/google/cloud/datastore/v1/doc/google/protobuf/wrappers.rb +0 -26
  27. data/lib/google/cloud/datastore/v1/doc/google/type/latlng.rb +0 -65
  28. data/lib/google/datastore/v1/datastore_pb.rb +0 -147
  29. data/lib/google/datastore/v1/datastore_services_pb.rb +0 -65
  30. data/lib/google/datastore/v1/entity_pb.rb +0 -64
  31. data/lib/google/datastore/v1/query_pb.rb +0 -132
@@ -1,297 +0,0 @@
1
- # Copyright 2020 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
- # https://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
-
16
- module Google
17
- module Datastore
18
- module V1
19
- # The result of fetching an entity from Datastore.
20
- # @!attribute [rw] entity
21
- # @return [Google::Datastore::V1::Entity]
22
- # The resulting entity.
23
- # @!attribute [rw] version
24
- # @return [Integer]
25
- # The version of the entity, a strictly positive number that monotonically
26
- # increases with changes to the entity.
27
- #
28
- # This field is set for {Google::Datastore::V1::EntityResult::ResultType::FULL `FULL`} entity
29
- # results.
30
- #
31
- # For {Google::Datastore::V1::LookupResponse#missing missing} entities in `LookupResponse`, this
32
- # is the version of the snapshot that was used to look up the entity, and it
33
- # is always set except for eventually consistent reads.
34
- # @!attribute [rw] cursor
35
- # @return [String]
36
- # A cursor that points to the position after the result entity.
37
- # Set only when the `EntityResult` is part of a `QueryResultBatch` message.
38
- class EntityResult
39
- # Specifies what data the 'entity' field contains.
40
- # A `ResultType` is either implied (for example, in `LookupResponse.missing`
41
- # from `datastore.proto`, it is always `KEY_ONLY`) or specified by context
42
- # (for example, in message `QueryResultBatch`, field `entity_result_type`
43
- # specifies a `ResultType` for all the values in field `entity_results`).
44
- module ResultType
45
- # Unspecified. This value is never used.
46
- RESULT_TYPE_UNSPECIFIED = 0
47
-
48
- # The key and properties.
49
- FULL = 1
50
-
51
- # A projected subset of properties. The entity may have no key.
52
- PROJECTION = 2
53
-
54
- # Only the key.
55
- KEY_ONLY = 3
56
- end
57
- end
58
-
59
- # A query for entities.
60
- # @!attribute [rw] projection
61
- # @return [Array<Google::Datastore::V1::Projection>]
62
- # The projection to return. Defaults to returning all properties.
63
- # @!attribute [rw] kind
64
- # @return [Array<Google::Datastore::V1::KindExpression>]
65
- # The kinds to query (if empty, returns entities of all kinds).
66
- # Currently at most 1 kind may be specified.
67
- # @!attribute [rw] filter
68
- # @return [Google::Datastore::V1::Filter]
69
- # The filter to apply.
70
- # @!attribute [rw] order
71
- # @return [Array<Google::Datastore::V1::PropertyOrder>]
72
- # The order to apply to the query results (if empty, order is unspecified).
73
- # @!attribute [rw] distinct_on
74
- # @return [Array<Google::Datastore::V1::PropertyReference>]
75
- # The properties to make distinct. The query results will contain the first
76
- # result for each distinct combination of values for the given properties
77
- # (if empty, all results are returned).
78
- # @!attribute [rw] start_cursor
79
- # @return [String]
80
- # A starting point for the query results. Query cursors are
81
- # returned in query result batches and
82
- # [can only be used to continue the same
83
- # query](https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets).
84
- # @!attribute [rw] end_cursor
85
- # @return [String]
86
- # An ending point for the query results. Query cursors are
87
- # returned in query result batches and
88
- # [can only be used to limit the same
89
- # query](https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets).
90
- # @!attribute [rw] offset
91
- # @return [Integer]
92
- # The number of results to skip. Applies before limit, but after all other
93
- # constraints. Optional. Must be >= 0 if specified.
94
- # @!attribute [rw] limit
95
- # @return [Google::Protobuf::Int32Value]
96
- # The maximum number of results to return. Applies after all other
97
- # constraints. Optional.
98
- # Unspecified is interpreted as no limit.
99
- # Must be >= 0 if specified.
100
- class Query; end
101
-
102
- # A representation of a kind.
103
- # @!attribute [rw] name
104
- # @return [String]
105
- # The name of the kind.
106
- class KindExpression; end
107
-
108
- # A reference to a property relative to the kind expressions.
109
- # @!attribute [rw] name
110
- # @return [String]
111
- # The name of the property.
112
- # If name includes "."s, it may be interpreted as a property name path.
113
- class PropertyReference; end
114
-
115
- # A representation of a property in a projection.
116
- # @!attribute [rw] property
117
- # @return [Google::Datastore::V1::PropertyReference]
118
- # The property to project.
119
- class Projection; end
120
-
121
- # The desired order for a specific property.
122
- # @!attribute [rw] property
123
- # @return [Google::Datastore::V1::PropertyReference]
124
- # The property to order by.
125
- # @!attribute [rw] direction
126
- # @return [Google::Datastore::V1::PropertyOrder::Direction]
127
- # The direction to order by. Defaults to `ASCENDING`.
128
- class PropertyOrder
129
- # The sort direction.
130
- module Direction
131
- # Unspecified. This value must not be used.
132
- DIRECTION_UNSPECIFIED = 0
133
-
134
- # Ascending.
135
- ASCENDING = 1
136
-
137
- # Descending.
138
- DESCENDING = 2
139
- end
140
- end
141
-
142
- # A holder for any type of filter.
143
- # @!attribute [rw] composite_filter
144
- # @return [Google::Datastore::V1::CompositeFilter]
145
- # A composite filter.
146
- # @!attribute [rw] property_filter
147
- # @return [Google::Datastore::V1::PropertyFilter]
148
- # A filter on a property.
149
- class Filter; end
150
-
151
- # A filter that merges multiple other filters using the given operator.
152
- # @!attribute [rw] op
153
- # @return [Google::Datastore::V1::CompositeFilter::Operator]
154
- # The operator for combining multiple filters.
155
- # @!attribute [rw] filters
156
- # @return [Array<Google::Datastore::V1::Filter>]
157
- # The list of filters to combine.
158
- # Must contain at least one filter.
159
- class CompositeFilter
160
- # A composite filter operator.
161
- module Operator
162
- # Unspecified. This value must not be used.
163
- OPERATOR_UNSPECIFIED = 0
164
-
165
- # The results are required to satisfy each of the combined filters.
166
- AND = 1
167
- end
168
- end
169
-
170
- # A filter on a specific property.
171
- # @!attribute [rw] property
172
- # @return [Google::Datastore::V1::PropertyReference]
173
- # The property to filter by.
174
- # @!attribute [rw] op
175
- # @return [Google::Datastore::V1::PropertyFilter::Operator]
176
- # The operator to filter by.
177
- # @!attribute [rw] value
178
- # @return [Google::Datastore::V1::Value]
179
- # The value to compare the property to.
180
- class PropertyFilter
181
- # A property filter operator.
182
- module Operator
183
- # Unspecified. This value must not be used.
184
- OPERATOR_UNSPECIFIED = 0
185
-
186
- # Less than.
187
- LESS_THAN = 1
188
-
189
- # Less than or equal.
190
- LESS_THAN_OR_EQUAL = 2
191
-
192
- # Greater than.
193
- GREATER_THAN = 3
194
-
195
- # Greater than or equal.
196
- GREATER_THAN_OR_EQUAL = 4
197
-
198
- # Equal.
199
- EQUAL = 5
200
-
201
- # Has ancestor.
202
- HAS_ANCESTOR = 11
203
- end
204
- end
205
-
206
- # A [GQL
207
- # query](https://cloud.google.com/datastore/docs/apis/gql/gql_reference).
208
- # @!attribute [rw] query_string
209
- # @return [String]
210
- # A string of the format described
211
- # [here](https://cloud.google.com/datastore/docs/apis/gql/gql_reference).
212
- # @!attribute [rw] allow_literals
213
- # @return [true, false]
214
- # When false, the query string must not contain any literals and instead must
215
- # bind all values. For example,
216
- # `SELECT * FROM Kind WHERE a = 'string literal'` is not allowed, while
217
- # `SELECT * FROM Kind WHERE a = @value` is.
218
- # @!attribute [rw] named_bindings
219
- # @return [Hash{String => Google::Datastore::V1::GqlQueryParameter}]
220
- # For each non-reserved named binding site in the query string, there must be
221
- # a named parameter with that name, but not necessarily the inverse.
222
- #
223
- # Key must match regex `[A-Za-z_$][A-Za-z_$0-9]*`, must not match regex
224
- # `__.*__`, and must not be `""`.
225
- # @!attribute [rw] positional_bindings
226
- # @return [Array<Google::Datastore::V1::GqlQueryParameter>]
227
- # Numbered binding site @1 references the first numbered parameter,
228
- # effectively using 1-based indexing, rather than the usual 0.
229
- #
230
- # For each binding site numbered i in `query_string`, there must be an i-th
231
- # numbered parameter. The inverse must also be true.
232
- class GqlQuery; end
233
-
234
- # A binding parameter for a GQL query.
235
- # @!attribute [rw] value
236
- # @return [Google::Datastore::V1::Value]
237
- # A value parameter.
238
- # @!attribute [rw] cursor
239
- # @return [String]
240
- # A query cursor. Query cursors are returned in query
241
- # result batches.
242
- class GqlQueryParameter; end
243
-
244
- # A batch of results produced by a query.
245
- # @!attribute [rw] skipped_results
246
- # @return [Integer]
247
- # The number of results skipped, typically because of an offset.
248
- # @!attribute [rw] skipped_cursor
249
- # @return [String]
250
- # A cursor that points to the position after the last skipped result.
251
- # Will be set when `skipped_results` != 0.
252
- # @!attribute [rw] entity_result_type
253
- # @return [Google::Datastore::V1::EntityResult::ResultType]
254
- # The result type for every entity in `entity_results`.
255
- # @!attribute [rw] entity_results
256
- # @return [Array<Google::Datastore::V1::EntityResult>]
257
- # The results for this batch.
258
- # @!attribute [rw] end_cursor
259
- # @return [String]
260
- # A cursor that points to the position after the last result in the batch.
261
- # @!attribute [rw] more_results
262
- # @return [Google::Datastore::V1::QueryResultBatch::MoreResultsType]
263
- # The state of the query after the current batch.
264
- # @!attribute [rw] snapshot_version
265
- # @return [Integer]
266
- # The version number of the snapshot this batch was returned from.
267
- # This applies to the range of results from the query's `start_cursor` (or
268
- # the beginning of the query if no cursor was given) to this batch's
269
- # `end_cursor` (not the query's `end_cursor`).
270
- #
271
- # In a single transaction, subsequent query result batches for the same query
272
- # can have a greater snapshot version number. Each batch's snapshot version
273
- # is valid for all preceding batches.
274
- # The value will be zero for eventually consistent queries.
275
- class QueryResultBatch
276
- # The possible values for the `more_results` field.
277
- module MoreResultsType
278
- # Unspecified. This value is never used.
279
- MORE_RESULTS_TYPE_UNSPECIFIED = 0
280
-
281
- # There may be additional batches to fetch from this query.
282
- NOT_FINISHED = 1
283
-
284
- # The query is finished, but there may be more results after the limit.
285
- MORE_RESULTS_AFTER_LIMIT = 2
286
-
287
- # The query is finished, but there may be more results after the end
288
- # cursor.
289
- MORE_RESULTS_AFTER_CURSOR = 4
290
-
291
- # The query is finished, and there are no more results.
292
- NO_MORE_RESULTS = 3
293
- end
294
- end
295
- end
296
- end
297
- end
@@ -1,74 +0,0 @@
1
- # Copyright 2018 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
- # https://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
-
16
- module Google
17
- module Protobuf
18
- # `Struct` represents a structured data value, consisting of fields
19
- # which map to dynamically typed values. In some languages, `Struct`
20
- # might be supported by a native representation. For example, in
21
- # scripting languages like JS a struct is represented as an
22
- # object. The details of that representation are described together
23
- # with the proto support for the language.
24
- #
25
- # The JSON representation for `Struct` is JSON object.
26
- # @!attribute [rw] fields
27
- # @return [Hash{String => Google::Protobuf::Value}]
28
- # Unordered map of dynamically typed values.
29
- class Struct; end
30
-
31
- # `Value` represents a dynamically typed value which can be either
32
- # null, a number, a string, a boolean, a recursive struct value, or a
33
- # list of values. A producer of value is expected to set one of that
34
- # variants, absence of any variant indicates an error.
35
- #
36
- # The JSON representation for `Value` is JSON value.
37
- # @!attribute [rw] null_value
38
- # @return [Google::Protobuf::NullValue]
39
- # Represents a null value.
40
- # @!attribute [rw] number_value
41
- # @return [Float]
42
- # Represents a double value.
43
- # @!attribute [rw] string_value
44
- # @return [String]
45
- # Represents a string value.
46
- # @!attribute [rw] bool_value
47
- # @return [true, false]
48
- # Represents a boolean value.
49
- # @!attribute [rw] struct_value
50
- # @return [Google::Protobuf::Struct]
51
- # Represents a structured value.
52
- # @!attribute [rw] list_value
53
- # @return [Google::Protobuf::ListValue]
54
- # Represents a repeated +Value+.
55
- class Value; end
56
-
57
- # `ListValue` is a wrapper around a repeated field of values.
58
- #
59
- # The JSON representation for `ListValue` is JSON array.
60
- # @!attribute [rw] values
61
- # @return [Array<Google::Protobuf::Value>]
62
- # Repeated field of dynamically typed values.
63
- class ListValue; end
64
-
65
- # `NullValue` is a singleton enumeration to represent the null value for the
66
- # `Value` type union.
67
- #
68
- # The JSON representation for `NullValue` is JSON +null+.
69
- module NullValue
70
- # Null value.
71
- NULL_VALUE = 0
72
- end
73
- end
74
- end
@@ -1,109 +0,0 @@
1
- # Copyright 2018 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
- # https://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
-
16
- module Google
17
- module Protobuf
18
- # A Timestamp represents a point in time independent of any time zone
19
- # or calendar, represented as seconds and fractions of seconds at
20
- # nanosecond resolution in UTC Epoch time. It is encoded using the
21
- # Proleptic Gregorian Calendar which extends the Gregorian calendar
22
- # backwards to year one. It is encoded assuming all minutes are 60
23
- # seconds long, i.e. leap seconds are "smeared" so that no leap second
24
- # table is needed for interpretation. Range is from
25
- # 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
26
- # By restricting to that range, we ensure that we can convert to
27
- # and from RFC 3339 date strings.
28
- # See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
29
- #
30
- # = Examples
31
- #
32
- # Example 1: Compute Timestamp from POSIX `time()`.
33
- #
34
- # Timestamp timestamp;
35
- # timestamp.set_seconds(time(NULL));
36
- # timestamp.set_nanos(0);
37
- #
38
- # Example 2: Compute Timestamp from POSIX `gettimeofday()`.
39
- #
40
- # struct timeval tv;
41
- # gettimeofday(&tv, NULL);
42
- #
43
- # Timestamp timestamp;
44
- # timestamp.set_seconds(tv.tv_sec);
45
- # timestamp.set_nanos(tv.tv_usec * 1000);
46
- #
47
- # Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
48
- #
49
- # FILETIME ft;
50
- # GetSystemTimeAsFileTime(&ft);
51
- # UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
52
- #
53
- # // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
54
- # // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
55
- # Timestamp timestamp;
56
- # timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
57
- # timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
58
- #
59
- # Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
60
- #
61
- # long millis = System.currentTimeMillis();
62
- #
63
- # Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
64
- # .setNanos((int) ((millis % 1000) * 1000000)).build();
65
- #
66
- #
67
- # Example 5: Compute Timestamp from current time in Python.
68
- #
69
- # timestamp = Timestamp()
70
- # timestamp.GetCurrentTime()
71
- #
72
- # = JSON Mapping
73
- #
74
- # In JSON format, the Timestamp type is encoded as a string in the
75
- # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
76
- # format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z"
77
- # where \\{year} is always expressed using four digits while \\{month}, \\{day},
78
- # \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional
79
- # seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
80
- # are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
81
- # is required. A proto3 JSON serializer should always use UTC (as indicated by
82
- # "Z") when printing the Timestamp type and a proto3 JSON parser should be
83
- # able to accept both UTC and other timezones (as indicated by an offset).
84
- #
85
- # For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
86
- # 01:30 UTC on January 15, 2017.
87
- #
88
- # In JavaScript, one can convert a Date object to this format using the
89
- # standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
90
- # method. In Python, a standard `datetime.datetime` object can be converted
91
- # to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
92
- # with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
93
- # can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
94
- # http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
95
- # ) to obtain a formatter capable of generating timestamps in this format.
96
- # @!attribute [rw] seconds
97
- # @return [Integer]
98
- # Represents seconds of UTC time since Unix epoch
99
- # 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
100
- # 9999-12-31T23:59:59Z inclusive.
101
- # @!attribute [rw] nanos
102
- # @return [Integer]
103
- # Non-negative fractions of a second at nanosecond resolution. Negative
104
- # second values with fractions must still have non-negative nanos values
105
- # that count forward in time. Must be from 0 to 999,999,999
106
- # inclusive.
107
- class Timestamp; end
108
- end
109
- end