statelydb 0.32.2 → 0.33.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.
- checksums.yaml +4 -4
- data/lib/api/db/list_pb.rb +1 -2
- data/lib/api/db/transaction_pb.rb +1 -2
- data/lib/key_path.rb +1 -1
- data/lib/statelydb.rb +154 -52
- data/lib/transaction/transaction.rb +77 -36
- data/lib/version.rb +1 -1
- data/rbi/db/list_pb.rbi +0 -20
- data/rbi/db/transaction_pb.rbi +0 -20
- data/rbi/statelydb.rbi +235 -76
- data/sig/statelydb.rbs +231 -73
- metadata +2 -3
- data/lib/api/db/item_property_pb.rb +0 -17
data/sig/statelydb.rbs
CHANGED
@@ -187,21 +187,23 @@ module StatelyDB
|
|
187
187
|
# _@return_ — nil
|
188
188
|
def close: () -> void
|
189
189
|
|
190
|
-
#
|
191
|
-
#
|
190
|
+
# Returns a new client that is either OK with or not OK with stale reads.
|
191
|
+
# This affects get and list operations from the returned client. Use this
|
192
|
+
# only if you know you can tolerate stale reads. This can result in improved
|
193
|
+
# performance, availability, and cost.
|
192
194
|
#
|
193
|
-
# _@param_ `allow_stale` —
|
195
|
+
# _@param_ `allow_stale` — Whether staleness is allowed or not.
|
194
196
|
#
|
195
|
-
# _@return_ —
|
197
|
+
# _@return_ — A clone of the existing client with allow_stale set to the new value.
|
196
198
|
#
|
197
199
|
# ```ruby
|
198
200
|
# client.with_allow_stale(true).get("/ItemType-identifier")
|
199
201
|
# ```
|
200
202
|
def with_allow_stale: (bool allow_stale) -> self
|
201
203
|
|
202
|
-
#
|
204
|
+
# get retrieves an item by its full key path.
|
203
205
|
#
|
204
|
-
# _@param_ `key_path` —
|
206
|
+
# _@param_ `key_path` — The full key path of the item.
|
205
207
|
#
|
206
208
|
# _@return_ — the Item or nil if not found
|
207
209
|
#
|
@@ -210,16 +212,21 @@ module StatelyDB
|
|
210
212
|
# ```
|
211
213
|
def get: ((StatelyDB::KeyPath | String) key_path) -> (StatelyDB::Item | NilClass)
|
212
214
|
|
213
|
-
#
|
215
|
+
# get_batch retrieves multiple items by their full key paths. This will
|
216
|
+
# return the corresponding items that exist. Use begin_list instead if you
|
217
|
+
# want to retrieve multiple items but don't already know the full key paths
|
218
|
+
# of the items you want to get. You can get items of different types in a
|
219
|
+
# single get_batch - you will need to check the class of each result to
|
220
|
+
# determine what item type it is.
|
214
221
|
#
|
215
|
-
# _@param_ `key_paths` —
|
222
|
+
# _@param_ `key_paths` — The full key path of each item to load.
|
216
223
|
#
|
217
|
-
# _@return_ — the
|
224
|
+
# _@return_ — the list of items that were found.
|
218
225
|
#
|
219
226
|
# ```ruby
|
220
227
|
# client.data.get_batch("/ItemType-identifier", "/ItemType-identifier2")
|
221
228
|
# ```
|
222
|
-
def get_batch: (*(StatelyDB::KeyPath | String | ::Array[(StatelyDB::KeyPath | String)]) key_paths) ->
|
229
|
+
def get_batch: (*(StatelyDB::KeyPath | String | ::Array[(StatelyDB::KeyPath | String)]) key_paths) -> ::Array[StatelyDB::Item]
|
223
230
|
|
224
231
|
# _@return_ — the list of Items and the token
|
225
232
|
#
|
@@ -229,7 +236,6 @@ module StatelyDB
|
|
229
236
|
def begin_list: (
|
230
237
|
untyped prefix,
|
231
238
|
?limit: untyped,
|
232
|
-
?sort_property: untyped,
|
233
239
|
?sort_direction: untyped,
|
234
240
|
?item_types: untyped,
|
235
241
|
?cel_filters: untyped,
|
@@ -239,9 +245,24 @@ module StatelyDB
|
|
239
245
|
?lte: untyped
|
240
246
|
) -> (::Array[StatelyDB::Item] | StatelyDB::Token)
|
241
247
|
|
242
|
-
#
|
243
|
-
#
|
244
|
-
#
|
248
|
+
# continue_list takes the token from a begin_list call and returns the next
|
249
|
+
# "page" of results based on the original query parameters and pagination
|
250
|
+
# options. It doesn't have options because it is a continuation of a
|
251
|
+
# previous list operation. It will return a new token which can be used for
|
252
|
+
# another continue_list call, and so on. The token is the same one used by
|
253
|
+
# sync_list - each time you call either continue_list or sync_list, you
|
254
|
+
# should pass the latest version of the token, and the result will include a
|
255
|
+
# new version of the token to use in subsequent calls. You may interleave
|
256
|
+
# continue_list and sync_list calls however you like, but it does not make
|
257
|
+
# sense to make both calls in parallel. Calls to continue_list are tied to
|
258
|
+
# the authorization of the original begin_list call, so if the original
|
259
|
+
# begin_list call was allowed, continue_list with its token should also be
|
260
|
+
# allowed.
|
261
|
+
#
|
262
|
+
# You can list items of different types in a single continue_list, and you
|
263
|
+
# can check the class of each result to handle different item types.
|
264
|
+
#
|
265
|
+
# _@param_ `token` — The latest token from a previous list operation.
|
245
266
|
#
|
246
267
|
# _@return_ — the list of Items and the token
|
247
268
|
#
|
@@ -251,13 +272,14 @@ module StatelyDB
|
|
251
272
|
# ```
|
252
273
|
def continue_list: (StatelyDB::Token token) -> (::Array[StatelyDB::Item] | StatelyDB::Token)
|
253
274
|
|
254
|
-
#
|
255
|
-
# the provided filters. This API returns a token that you can pass
|
256
|
-
# continue_scan to paginate through the result set.
|
257
|
-
#
|
275
|
+
# begin_scan initiates a scan request which will scan over the entire store
|
276
|
+
# and apply the provided filters. This API returns a token that you can pass
|
277
|
+
# to continue_scan to paginate through the result set.
|
278
|
+
#
|
279
|
+
# begin_scan can return items of many types, and you can check the class of
|
280
|
+
# each result to handle different item types.
|
258
281
|
#
|
259
|
-
# WARNING: THIS API CAN BE
|
260
|
-
# OF ITEMS.
|
282
|
+
# WARNING: THIS API CAN BE EXPENSIVE FOR STORES WITH A LARGE NUMBER OF ITEMS.
|
261
283
|
#
|
262
284
|
# _@param_ `limit` — the max number of items to retrieve. If set to 0 then the first page of results will be returned which may empty because it does not contain items of your selected item types. Be sure to check token.can_continue to see if there are more results to fetch.
|
263
285
|
#
|
@@ -282,12 +304,14 @@ module StatelyDB
|
|
282
304
|
?segment_index: Integer?
|
283
305
|
) -> (::Array[StatelyDB::Item] | StatelyDB::Token)
|
284
306
|
|
285
|
-
# continue_scan takes the token from a begin_scan call and returns
|
286
|
-
# based on the original
|
307
|
+
# continue_scan takes the token from a begin_scan call and returns the
|
308
|
+
# next "page" of results based on the original query parameters and
|
309
|
+
# pagination options.
|
287
310
|
#
|
288
|
-
#
|
311
|
+
# You can scan items of different types in a single continue_scan, and you
|
312
|
+
# can check the class of each result to handle different item types.
|
289
313
|
#
|
290
|
-
# _@param_ `token` — the token
|
314
|
+
# _@param_ `token` — the token from the previous scan operation.
|
291
315
|
#
|
292
316
|
# _@return_ — the list of Items and the token
|
293
317
|
#
|
@@ -297,7 +321,39 @@ module StatelyDB
|
|
297
321
|
# ```
|
298
322
|
def continue_scan: (StatelyDB::Token token) -> (::Array[StatelyDB::Item] | StatelyDB::Token)
|
299
323
|
|
300
|
-
#
|
324
|
+
# sync_list returns all changes to Items within the result set of a previous
|
325
|
+
# List operation. For all Items within the result set that were modified, it
|
326
|
+
# returns the full Item at in its current state. If the result set has
|
327
|
+
# already been expanded to the end (in the direction of the original
|
328
|
+
# begin_list request), sync_list will return newly created Items as well. It
|
329
|
+
# also returns a list of Item key paths that were deleted since the last
|
330
|
+
# sync_list, which you should reconcile with your view of items returned
|
331
|
+
# from previous begin_list/continue_list calls. Using this API, you can
|
332
|
+
# start with an initial set of items from begin_list, and then stay up to
|
333
|
+
# date on any changes via repeated sync_list requests over time.
|
334
|
+
#
|
335
|
+
# The token is the same one used by continue_list - each time you call
|
336
|
+
# either continue_list or sync_list, you should pass the latest version of
|
337
|
+
# the token, and then use the new token from the result in subsequent calls.
|
338
|
+
# You may interleave continue_list and sync_list calls however you like, but
|
339
|
+
# it does not make sense to make both calls in parallel. Calls to sync_list
|
340
|
+
# are tied to the authorization of the original begin_list call, so if the
|
341
|
+
# original begin_list call was allowed, sync_list with its token should also
|
342
|
+
# be allowed.
|
343
|
+
#
|
344
|
+
# The result will contain:
|
345
|
+
# - changed_items: Items that were changed or added since the last
|
346
|
+
# sync_list call.
|
347
|
+
# - deleted_item_paths: The key paths of items that were deleted since
|
348
|
+
# the last sync_list call.
|
349
|
+
# - updated_outside_list_window_paths: Item that were updated but
|
350
|
+
# are not within the current result set. You can treat this like
|
351
|
+
# deleted_item_paths, but the item hasn't actually been deleted, it's
|
352
|
+
# just not part of your view of the list anymore.
|
353
|
+
# - is_reset: A reset signal that indicates any previously cached
|
354
|
+
# view of the result set is no longer valid. You should throw away
|
355
|
+
# any locally cached data. Use the changed_items list from this result
|
356
|
+
# as the new view of the result set.
|
301
357
|
#
|
302
358
|
# _@param_ `token` — the token to sync from
|
303
359
|
#
|
@@ -309,15 +365,22 @@ module StatelyDB
|
|
309
365
|
# ```
|
310
366
|
def sync_list: (StatelyDB::Token token) -> StatelyDB::SyncResult
|
311
367
|
|
312
|
-
#
|
368
|
+
# put adds an Item to the Store, or replaces the Item if it already exists
|
369
|
+
# at that path.
|
370
|
+
#
|
371
|
+
# This call will fail if:
|
372
|
+
# - The Item conflicts with an existing Item at the same path and the
|
373
|
+
# must_not_exist option is set, or the item's ID will be chosen with
|
374
|
+
# an `initialValue` and one of its other key paths conflicts with an
|
375
|
+
# existing item.
|
313
376
|
#
|
314
|
-
# _@param_ `item` —
|
377
|
+
# _@param_ `item` — An Item from your generated schema.
|
315
378
|
#
|
316
379
|
# _@param_ `must_not_exist` — A condition that indicates this item must not already exist at any of its key paths. If there is already an item at one of those paths, the Put operation will fail with a "ConditionalCheckFailed" error. Note that if the item has an `initialValue` field in its key, that initial value will automatically be chosen not to conflict with existing items, so this condition only applies to key paths that do not contain the `initialValue` field.
|
317
380
|
#
|
318
381
|
# _@param_ `overwrite_metadata_timestamps` — If set to true, the server will set the `createdAtTime` and/or `lastModifiedAtTime` fields based on the current values in this item (assuming you've mapped them to a field using `fromMetadata`). Without this, those fields are always ignored and the server sets them to the appropriate times. This option can be useful when migrating data from another system.
|
319
382
|
#
|
320
|
-
# _@return_ —
|
383
|
+
# _@return_ — The item that was put, with any server-generated fields filled in.
|
321
384
|
#
|
322
385
|
# client.data.put(my_item)
|
323
386
|
# ```ruby
|
@@ -328,13 +391,21 @@ module StatelyDB
|
|
328
391
|
# ```
|
329
392
|
def put: (StatelyDB::Item item, ?must_not_exist: bool, ?overwrite_metadata_timestamps: bool) -> StatelyDB::Item
|
330
393
|
|
331
|
-
#
|
394
|
+
# put_batch adds multiple Items to the Store, or replaces Items if they
|
395
|
+
# already exist at that path. You can put items of different types in a
|
396
|
+
# single put_batch. All puts in the request are applied atomically - there
|
397
|
+
# are no partial successes.
|
332
398
|
#
|
333
|
-
#
|
399
|
+
# This will fail if:
|
400
|
+
# - Any Item conflicts with an existing Item at the same path and its
|
401
|
+
# must_not_exist option is set, or the item's ID will be chosen with an
|
402
|
+
# `initialValue` and one of its other key paths conflicts with an existing
|
403
|
+
# item.
|
334
404
|
#
|
335
|
-
# _@param_ `items` —
|
405
|
+
# _@param_ `items` — Items from your generated schema.
|
336
406
|
#
|
337
|
-
# _@return_ —
|
407
|
+
# _@return_ — The items that were put, with any server-generated fields filled in.
|
408
|
+
# They are returned in the same order they were provided.
|
338
409
|
#
|
339
410
|
# ```ruby
|
340
411
|
# client.data.put_batch(item1, item2)
|
@@ -345,20 +416,46 @@ module StatelyDB
|
|
345
416
|
# ```
|
346
417
|
def put_batch: (*(StatelyDB::Item | ::Array[StatelyDB::Item]) items) -> ::Array[StatelyDB::Item]
|
347
418
|
|
348
|
-
#
|
419
|
+
# delete removes one or more items from the Store by their full key paths.
|
420
|
+
# delete succeeds even if there isn't an item at that key path. Tombstones
|
421
|
+
# will be saved for deleted items for some time, so that sync_list can
|
422
|
+
# return information about deleted items. Deletes are always applied
|
423
|
+
# atomically; all will fail or all will succeed.
|
424
|
+
#
|
425
|
+
# The full key paths of the items. @raise [StatelyDB::Error] if the
|
426
|
+
# parameters are invalid @raise [StatelyDB::Error] if the item is not found
|
349
427
|
#
|
350
|
-
# _@param_ `key_paths`
|
428
|
+
# _@param_ `key_paths`
|
351
429
|
#
|
352
430
|
# _@return_ — nil
|
353
431
|
#
|
432
|
+
# client.data.delete("/ItemType-identifier",
|
354
433
|
# ```ruby
|
355
|
-
#
|
434
|
+
# "/ItemType-identifier2")
|
356
435
|
# ```
|
357
436
|
def delete: (*(StatelyDB::KeyPath | String | ::Array[(StatelyDB::KeyPath | String)]) key_paths) -> void
|
358
437
|
|
359
|
-
#
|
360
|
-
#
|
361
|
-
#
|
438
|
+
# transaction allows you to issue reads and writes in any order, and all
|
439
|
+
# writes will either succeed or all will fail when the transaction finishes.
|
440
|
+
# It takes a block with a single argument that can be used to run commands
|
441
|
+
# within the transaction.
|
442
|
+
#
|
443
|
+
# Reads are guaranteed to reflect the state as of when the transaction
|
444
|
+
# started. A transaction may fail if another transaction commits before this
|
445
|
+
# one finishes - in that case, you should retry your transaction.
|
446
|
+
#
|
447
|
+
# If any error is thrown from the block, the transaction is aborted and none
|
448
|
+
# of the changes made in it will be applied. If the handler returns without
|
449
|
+
# error, the transaction is automatically committed.
|
450
|
+
#
|
451
|
+
# If any of the operations in the block fails (e.g. a request is invalid)
|
452
|
+
# you may not find out until the *next* operation, or once the block
|
453
|
+
# finishes, due to some technicalities about how requests are handled.
|
454
|
+
#
|
455
|
+
# When the transaction is committed, the result property will contain the
|
456
|
+
# full version of any items that were put in the transaction, and the
|
457
|
+
# committed property will be True. If the transaction was aborted, the
|
458
|
+
# committed property will be False.
|
362
459
|
#
|
363
460
|
# _@return_ — the result of the transaction
|
364
461
|
#
|
@@ -805,10 +902,9 @@ module StatelyDB
|
|
805
902
|
# _@return_ — true if a transaction is open
|
806
903
|
def open?: () -> bool
|
807
904
|
|
808
|
-
#
|
809
|
-
# transaction.
|
905
|
+
# get retrieves an item by its full key path.
|
810
906
|
#
|
811
|
-
# _@param_ `key_path` —
|
907
|
+
# _@param_ `key_path` — The full key path of the item.
|
812
908
|
#
|
813
909
|
# _@return_ — the item or nil if not found
|
814
910
|
#
|
@@ -819,9 +915,12 @@ module StatelyDB
|
|
819
915
|
# ```
|
820
916
|
def get: ((StatelyDB::KeyPath | String) key_path) -> (StatelyDB::Item | NilClass)
|
821
917
|
|
822
|
-
#
|
823
|
-
#
|
824
|
-
#
|
918
|
+
# get_batch retrieves multiple items by their full key paths. This will
|
919
|
+
# return the corresponding items that exist. Use begin_list instead if you
|
920
|
+
# want to retrieve multiple items but don't already know the full key
|
921
|
+
# paths of the items you want to get. You can get items of different types
|
922
|
+
# in a single get_batch - you will need to check the class of each result
|
923
|
+
# to determine what item type each item is.
|
825
924
|
#
|
826
925
|
# key paths.
|
827
926
|
# Example:
|
@@ -829,26 +928,34 @@ module StatelyDB
|
|
829
928
|
# items = txn.get_batch("/foo", "/bar")
|
830
929
|
# end
|
831
930
|
#
|
832
|
-
# _@param_ `key_paths` — the paths to the items.
|
931
|
+
# _@param_ `key_paths` — the paths to the items.
|
833
932
|
#
|
834
933
|
# _@return_ — the items
|
835
934
|
def get_batch: (*(StatelyDB::KeyPath | String | ::Array[(StatelyDB::KeyPath | String)]) key_paths) -> ::Array[StatelyDB::Item]
|
836
935
|
|
837
|
-
#
|
838
|
-
#
|
839
|
-
# the item
|
936
|
+
# put adds an Item to the Store, or replaces the Item if it already exists
|
937
|
+
# at that path. Unlike the put method outside of a transaction, this only
|
938
|
+
# returns the generated ID of the item, and then only if the item was
|
939
|
+
# newly created and has an `initialValue` field in its key. This is so you
|
940
|
+
# can use that ID in subsequent puts to reference newly created items. The
|
941
|
+
# final put items will not be returned until the transaction is committed,
|
942
|
+
# in which case they will be included in the `StatelyDB::Transaction::Transaction::Result.puts`
|
943
|
+
# list.
|
840
944
|
#
|
841
945
|
# results.puts.each do |result|
|
842
946
|
# puts result.key_path
|
843
947
|
# end
|
844
948
|
#
|
845
|
-
# _@param_ `item` — the item to
|
949
|
+
# _@param_ `item` — the item to put
|
846
950
|
#
|
847
951
|
# _@param_ `must_not_exist` — A condition that indicates this item must not already exist at any of its key paths. If there is already an item at one of those paths, the Put operation will fail with a "ConditionalCheckFailed" error. Note that if the item has an `initialValue` field in its key, that initial value will automatically be chosen not to conflict with existing items, so this condition only applies to key paths that do not contain the `initialValue` field.
|
848
952
|
#
|
849
953
|
# _@param_ `overwrite_metadata_timestamps` — If set to true, the server will set the `createdAtTime` and/or `lastModifiedAtTime` fields based on the current values in this item (assuming you've mapped them to a field using `fromMetadata`). Without this, those fields are always ignored and the server sets them to the appropriate times. This option can be useful when migrating data from another system.
|
850
954
|
#
|
851
|
-
# _@return_ —
|
955
|
+
# _@return_ — a generated IDs for the item, if that item had an ID generated
|
956
|
+
# for its "initialValue" field. Otherwise the value is None. This
|
957
|
+
# value can be used in subsequent puts to reference newly created
|
958
|
+
# items.
|
852
959
|
#
|
853
960
|
# ```ruby
|
854
961
|
# results = client.data.transaction do |txn|
|
@@ -857,19 +964,27 @@ module StatelyDB
|
|
857
964
|
# ```
|
858
965
|
def put: (StatelyDB::Item item, ?must_not_exist: bool, ?overwrite_metadata_timestamps: bool) -> (String | Integer)
|
859
966
|
|
860
|
-
#
|
861
|
-
#
|
862
|
-
#
|
863
|
-
#
|
967
|
+
# put_batch adds multiple Items to the Store, or replaces Items if they
|
968
|
+
# already exist at that path. You can put items of different types in a
|
969
|
+
# single put_batch. Unlike the put_batch method outside of a transaction,
|
970
|
+
# this only returns the generated IDs of the items, and then only if the
|
971
|
+
# item was newly created and has an `initialValue` field in its key. The
|
972
|
+
# IDs are returned in the same order as the inputs. This is so you can use
|
973
|
+
# that ID in subsequent puts to reference newly created items. The final
|
974
|
+
# put items will not be returned until the transaction is committed, in
|
975
|
+
# which case they will be included in the `StatelyDB::Transaction::Transaction::Result.puts` list.
|
864
976
|
#
|
865
|
-
# 50 items.
|
866
977
|
# results.puts.each do |result|
|
867
978
|
# puts result.key_path
|
868
979
|
# end
|
869
980
|
#
|
870
|
-
# _@param_ `items` — the items to
|
981
|
+
# _@param_ `items` — the items to put
|
871
982
|
#
|
872
|
-
# _@return_ —
|
983
|
+
# _@return_ — an array of
|
984
|
+
# generated IDs for each item, if that item had an ID generated for its
|
985
|
+
# "initialValue" field. Otherwise the value is None.
|
986
|
+
# These are returned in the same order as the input items. This value
|
987
|
+
# can be used in subsequent puts to reference newly created items.
|
873
988
|
#
|
874
989
|
# ```ruby
|
875
990
|
# results = client.data.transaction do |txn|
|
@@ -878,40 +993,84 @@ module StatelyDB
|
|
878
993
|
# ```
|
879
994
|
def put_batch: (*(StatelyDB::Item | ::Array[StatelyDB::Item]) items) -> ::Array[(StatelyDB::UUID | String | Integer | NilClass)]
|
880
995
|
|
881
|
-
#
|
882
|
-
#
|
996
|
+
# delete removes one or more items from the Store by their full key paths.
|
997
|
+
# delete succeeds even if there isn't an item at that key path.
|
883
998
|
#
|
884
999
|
# Example:
|
885
1000
|
# client.data.transaction do |txn|
|
886
1001
|
# txn.delete("/ItemType-identifier", "/ItemType-identifier2")
|
887
1002
|
# end
|
888
1003
|
#
|
889
|
-
# _@param_ `key_paths` —
|
1004
|
+
# _@param_ `key_paths` — The full key paths of the items
|
890
1005
|
#
|
891
1006
|
# _@return_ — nil
|
892
1007
|
def delete: (*(StatelyDB::KeyPath | String | ::Array[(StatelyDB::KeyPath | String)]) key_paths) -> void
|
893
1008
|
|
1009
|
+
# begin_list retrieves Items that start with a specified key_path_prefix
|
1010
|
+
# from a single Group. Because it can only list items from a single Group,
|
1011
|
+
# the key path prefix must at least start with a full Group Key (a single
|
1012
|
+
# key segment with a namespace and an ID, e.g. `/user-1234`).
|
1013
|
+
#
|
1014
|
+
# begin_list will return an empty result set if there are no items
|
1015
|
+
# matching that key prefix. This API returns a token that you can pass to
|
1016
|
+
# continue_list to expand the result set.
|
1017
|
+
#
|
1018
|
+
# You can list items of different types in a single begin_list, and you
|
1019
|
+
# can check the class of each result to handle different item types.
|
1020
|
+
#
|
894
1021
|
# Example:
|
895
1022
|
# client.data.transaction do |txn|
|
896
1023
|
# (items, token) = txn.begin_list("/ItemType-identifier")
|
897
1024
|
# (items, token) = txn.continue_list(token)
|
898
1025
|
# end
|
899
1026
|
#
|
1027
|
+
# _@param_ `prefix` — the key path prefix to query for. It must be at least a full Group Key (e.g. `/user-1234`).
|
1028
|
+
#
|
1029
|
+
# _@param_ `limit` — the max number of Items to retrieve. Defaults to 0 which fetches all Items.
|
1030
|
+
#
|
1031
|
+
# _@param_ `sort_direction` — the direction to sort by (:ascending or :descending)
|
1032
|
+
#
|
1033
|
+
# _@param_ `item_types` — the item types to filter by. The returned items will be instances of one of these types.
|
1034
|
+
#
|
1035
|
+
# _@param_ `cel_filters` — ] An optional list of item_type, cel_expression tuples that represent CEL expressions to filter the results set by. Use the cel_filter helper function to build these expressions. CEL expressions are only evaluated for the item type they are defined for, and do not affect other item types in the result set. This means if an item type has no CEL filter and there are no item_type filters constraints, it will be included in the result set. In the context of a CEL expression, the key-word `this` refers to the item being evaluated, and property properties should be accessed by the names as they appear in schema -- not necessarily as they appear in the generated code for a particular language. For example, if you have a `Movie` item type with the property `rating`, you could write a CEL expression like `this.rating == 'R'` to return only movies that are rated `R`. Find the full CEL language definition here: https://github.com/google/cel-spec/blob/master/doc/langdef.md
|
1036
|
+
#
|
1037
|
+
# _@param_ `gt` — filters results to only include items with a key greater than the specified value based on lexicographic ordering.
|
1038
|
+
#
|
1039
|
+
# _@param_ `gte` — filters results to only include items with a key greater than or equal to the specified value based on lexicographic ordering.
|
1040
|
+
#
|
1041
|
+
# _@param_ `lt` — filters results to only include items with a key less than the specified value based on lexicographic ordering.
|
1042
|
+
#
|
1043
|
+
# _@param_ `lte` — filters results to only include items with a key less than or equal to the specified value based on lexicographic ordering.
|
1044
|
+
#
|
900
1045
|
# _@return_ — the list of Items and the token
|
901
1046
|
def begin_list: (
|
902
|
-
|
903
|
-
?limit:
|
904
|
-
?
|
905
|
-
?
|
906
|
-
?
|
907
|
-
?
|
908
|
-
?
|
909
|
-
?
|
910
|
-
?
|
911
|
-
?lte: untyped
|
1047
|
+
(StatelyDB::KeyPath | String) prefix,
|
1048
|
+
?limit: Integer,
|
1049
|
+
?sort_direction: Symbol,
|
1050
|
+
?item_types: ::Array[(StatelyDB::Item | String)],
|
1051
|
+
?cel_filters: ::Array[(::Array[(Class | String)] | String)],
|
1052
|
+
?gt: (StatelyDB::KeyPath | String)?,
|
1053
|
+
?gte: (StatelyDB::KeyPath | String)?,
|
1054
|
+
?lt: (StatelyDB::KeyPath | String)?,
|
1055
|
+
?lte: (StatelyDB::KeyPath | String)?
|
912
1056
|
) -> [::Array[StatelyDB::Item], ::Stately::Db::ListToken]
|
913
1057
|
|
914
|
-
#
|
1058
|
+
# continue_list takes the token from a begin_list call and returns the
|
1059
|
+
# next "page" of results based on the original query parameters and
|
1060
|
+
# pagination options. It doesn't have options because it is a continuation
|
1061
|
+
# of a previous list operation. It will return a new token which can be
|
1062
|
+
# used for another continue_list call, and so on. The token is the same
|
1063
|
+
# one used by sync_list - each time you call either continue_list or
|
1064
|
+
# sync_list, you should pass the latest version of the token, and the
|
1065
|
+
# result will include a new version of the token to use in subsequent
|
1066
|
+
# calls. You may interleave continue_list and sync_list calls however you
|
1067
|
+
# like, but it does not make sense to make both calls in parallel. Calls
|
1068
|
+
# to continue_list are tied to the authorization of the original
|
1069
|
+
# begin_list call, so if the original begin_list call was allowed,
|
1070
|
+
# continue_list with its token should also be allowed.
|
1071
|
+
#
|
1072
|
+
# You can list items of different types in a single continueList, and you can
|
1073
|
+
# check the class of each result to handle different item types.
|
915
1074
|
#
|
916
1075
|
# Example:
|
917
1076
|
# client.data.transaction do |txn|
|
@@ -919,7 +1078,7 @@ module StatelyDB
|
|
919
1078
|
# (items, token) = txn.continue_list(token)
|
920
1079
|
# end
|
921
1080
|
#
|
922
|
-
# _@param_ `token` — the token
|
1081
|
+
# _@param_ `token` — the token from the previous list operation
|
923
1082
|
#
|
924
1083
|
# _@param_ `continue_direction` — the direction to continue by (:forward or :backward)
|
925
1084
|
#
|
@@ -1017,7 +1176,6 @@ module Stately
|
|
1017
1176
|
ContinueListRequest: untyped
|
1018
1177
|
ContinueListDirection: untyped
|
1019
1178
|
ContinueScanRequest: untyped
|
1020
|
-
SortableProperty: untyped
|
1021
1179
|
|
1022
1180
|
module DatabaseService
|
1023
1181
|
Stub: untyped
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: statelydb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.33.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stately Cloud, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-08-
|
11
|
+
date: 2025-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -98,7 +98,6 @@ files:
|
|
98
98
|
- lib/api/db/delete_pb.rb
|
99
99
|
- lib/api/db/get_pb.rb
|
100
100
|
- lib/api/db/item_pb.rb
|
101
|
-
- lib/api/db/item_property_pb.rb
|
102
101
|
- lib/api/db/list_filters_pb.rb
|
103
102
|
- lib/api/db/list_pb.rb
|
104
103
|
- lib/api/db/list_token_pb.rb
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
-
# source: db/item_property.proto
|
4
|
-
|
5
|
-
require 'google/protobuf'
|
6
|
-
|
7
|
-
|
8
|
-
descriptor_data = "\n\x16\x64\x62/item_property.proto\x12\nstately.db*\x8b\x02\n\x10SortableProperty\x12\x1e\n\x1aSORTABLE_PROPERTY_KEY_PATH\x10\x00\x12+\n\'SORTABLE_PROPERTY_LAST_MODIFIED_VERSION\x10\x01\x12)\n%SORTABLE_PROPERTY_GROUP_LOCAL_INDEX_1\x10\x08\x12)\n%SORTABLE_PROPERTY_GROUP_LOCAL_INDEX_2\x10\t\x12)\n%SORTABLE_PROPERTY_GROUP_LOCAL_INDEX_3\x10\n\x12)\n%SORTABLE_PROPERTY_GROUP_LOCAL_INDEX_4\x10\x0b\x42l\n\x0e\x63om.stately.dbB\x11ItemPropertyProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
|
9
|
-
|
10
|
-
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
11
|
-
pool.add_serialized_file(descriptor_data)
|
12
|
-
|
13
|
-
module Stately
|
14
|
-
module Db
|
15
|
-
SortableProperty = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.SortableProperty").enummodule
|
16
|
-
end
|
17
|
-
end
|