statelydb 0.28.0 → 0.29.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/transaction_pb.rb +1 -1
- data/lib/key_path.rb +2 -1
- data/lib/statelydb.rb +31 -3
- data/lib/transaction/transaction.rb +36 -2
- data/lib/version.rb +1 -1
- data/rbi/db/transaction_pb.rbi +100 -2
- data/rbi/statelydb.rbi +22 -31
- data/sig/statelydb.rbs +20 -29
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d5953d075d48d8ca4449644bb88fe0792587f00da52e29d0937b02416b0c0a0
|
4
|
+
data.tar.gz: 424e94dd43130382ec000b986d701581dd3a76a7e404ae7c4d2f0b3f3d8927b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f4c26cdb3399124ee45110ad92611551a64d14df7548d92a537797eef804191d538c267bfc82d9c6c20f9e2f3812fd13f9f4fcfb3b60339df743b265b05e1e9
|
7
|
+
data.tar.gz: 4661408175189b2ef7320a145bee131404eb0b6a542b00e846dfb8fee0a4d3fdbdfb660d43a675b7362d5b7b94d6e17c3fd0a63cda284e624e4d13419ab7b3be
|
@@ -15,7 +15,7 @@ require 'api/db/put_pb'
|
|
15
15
|
require 'google/protobuf/empty_pb'
|
16
16
|
|
17
17
|
|
18
|
-
descriptor_data = "\n\x14\x64\x62/transaction.proto\x12\nstately.db\x1a\x16\x64\x62/continue_list.proto\x1a\x0f\x64\x62/delete.proto\x1a\x0c\x64\x62/get.proto\x1a\rdb/item.proto\x1a\x16\x64\x62/item_property.proto\x1a\rdb/list.proto\x1a\x15\x64\x62/list_filters.proto\x1a\x0c\x64\x62/put.proto\x1a\x1bgoogle/protobuf/empty.proto\"\x9f\x04\n\x12TransactionRequest\x12\x1d\n\nmessage_id\x18\x01 \x01(\rR\tmessageId\x12\x34\n\x05\x62\x65gin\x18\x02 \x01(\x0b\x32\x1c.stately.db.TransactionBeginH\x00R\x05\x62\x65gin\x12\x39\n\tget_items\x18\x03 \x01(\x0b\x32\x1a.stately.db.TransactionGetH\x00R\x08getItems\x12\x41\n\nbegin_list\x18\x04 \x01(\x0b\x32 .stately.db.TransactionBeginListH\x00R\tbeginList\x12J\n\rcontinue_list\x18\x05 \x01(\x0b\x32#.stately.db.TransactionContinueListH\x00R\x0c\x63ontinueList\x12\x39\n\tput_items\x18\x06 \x01(\x0b\x32\x1a.stately.db.TransactionPutH\x00R\x08putItems\x12\x42\n\x0c\x64\x65lete_items\x18\x07 \x01(\x0b\x32\x1d.stately.db.TransactionDeleteH\x00R\x0b\x64\x65leteItems\x12\x30\n\x06\x63ommit\x18\x08 \x01(\x0b\x32\x16.google.protobuf.EmptyH\x00R\x06\x63ommit\x12.\n\x05\x61\x62ort\x18\t \x01(\x0b\x32\x16.google.protobuf.EmptyH\x00R\x05\x61\x62ortB\t\n\x07\x63ommand\"\xc8\x02\n\x13TransactionResponse\x12\x1d\n\nmessage_id\x18\x01 \x01(\rR\tmessageId\x12\x45\n\x0bget_results\x18\x02 \x01(\x0b\x32\".stately.db.TransactionGetResponseH\x00R\ngetResults\x12\x38\n\x07put_ack\x18\x03 \x01(\x0b\x32\x1d.stately.db.TransactionPutAckH\x00R\x06putAck\x12H\n\x0clist_results\x18\x04 \x01(\x0b\x32#.stately.db.TransactionListResponseH\x00R\x0blistResults\x12=\n\x08\x66inished\x18\x05 \x01(\x0b\x32\x1f.stately.db.TransactionFinishedH\x00R\x08\x66inishedB\x08\n\x06result\"v\n\x10TransactionBegin\x12\x19\n\x08store_id\x18\x01 \x01(\x04R\x07storeId\x12*\n\x11schema_version_id\x18\x02 \x01(\rR\x0fschemaVersionId\x12\x1b\n\tschema_id\x18\x03 \x01(\x04R\x08schemaId\"9\n\x0eTransactionGet\x12\'\n\x04gets\x18\x01 \x03(\x0b\x32\x13.stately.db.GetItemR\x04gets\"\
|
18
|
+
descriptor_data = "\n\x14\x64\x62/transaction.proto\x12\nstately.db\x1a\x16\x64\x62/continue_list.proto\x1a\x0f\x64\x62/delete.proto\x1a\x0c\x64\x62/get.proto\x1a\rdb/item.proto\x1a\x16\x64\x62/item_property.proto\x1a\rdb/list.proto\x1a\x15\x64\x62/list_filters.proto\x1a\x0c\x64\x62/put.proto\x1a\x1bgoogle/protobuf/empty.proto\"\x9f\x04\n\x12TransactionRequest\x12\x1d\n\nmessage_id\x18\x01 \x01(\rR\tmessageId\x12\x34\n\x05\x62\x65gin\x18\x02 \x01(\x0b\x32\x1c.stately.db.TransactionBeginH\x00R\x05\x62\x65gin\x12\x39\n\tget_items\x18\x03 \x01(\x0b\x32\x1a.stately.db.TransactionGetH\x00R\x08getItems\x12\x41\n\nbegin_list\x18\x04 \x01(\x0b\x32 .stately.db.TransactionBeginListH\x00R\tbeginList\x12J\n\rcontinue_list\x18\x05 \x01(\x0b\x32#.stately.db.TransactionContinueListH\x00R\x0c\x63ontinueList\x12\x39\n\tput_items\x18\x06 \x01(\x0b\x32\x1a.stately.db.TransactionPutH\x00R\x08putItems\x12\x42\n\x0c\x64\x65lete_items\x18\x07 \x01(\x0b\x32\x1d.stately.db.TransactionDeleteH\x00R\x0b\x64\x65leteItems\x12\x30\n\x06\x63ommit\x18\x08 \x01(\x0b\x32\x16.google.protobuf.EmptyH\x00R\x06\x63ommit\x12.\n\x05\x61\x62ort\x18\t \x01(\x0b\x32\x16.google.protobuf.EmptyH\x00R\x05\x61\x62ortB\t\n\x07\x63ommand\"\xc8\x02\n\x13TransactionResponse\x12\x1d\n\nmessage_id\x18\x01 \x01(\rR\tmessageId\x12\x45\n\x0bget_results\x18\x02 \x01(\x0b\x32\".stately.db.TransactionGetResponseH\x00R\ngetResults\x12\x38\n\x07put_ack\x18\x03 \x01(\x0b\x32\x1d.stately.db.TransactionPutAckH\x00R\x06putAck\x12H\n\x0clist_results\x18\x04 \x01(\x0b\x32#.stately.db.TransactionListResponseH\x00R\x0blistResults\x12=\n\x08\x66inished\x18\x05 \x01(\x0b\x32\x1f.stately.db.TransactionFinishedH\x00R\x08\x66inishedB\x08\n\x06result\"v\n\x10TransactionBegin\x12\x19\n\x08store_id\x18\x01 \x01(\x04R\x07storeId\x12*\n\x11schema_version_id\x18\x02 \x01(\rR\x0fschemaVersionId\x12\x1b\n\tschema_id\x18\x03 \x01(\x04R\x08schemaId\"9\n\x0eTransactionGet\x12\'\n\x04gets\x18\x01 \x03(\x0b\x32\x13.stately.db.GetItemR\x04gets\"\xe4\x02\n\x14TransactionBeginList\x12&\n\x0fkey_path_prefix\x18\x01 \x01(\tR\rkeyPathPrefix\x12\x14\n\x05limit\x18\x02 \x01(\rR\x05limit\x12\x41\n\rsort_property\x18\x03 \x01(\x0e\x32\x1c.stately.db.SortablePropertyR\x0csortProperty\x12@\n\x0esort_direction\x18\x04 \x01(\x0e\x32\x19.stately.db.SortDirectionR\rsortDirection\x12H\n\x11\x66ilter_conditions\x18\t \x03(\x0b\x32\x1b.stately.db.FilterConditionR\x10\x66ilterConditions\x12?\n\x0ekey_conditions\x18\n \x03(\x0b\x32\x18.stately.db.KeyConditionR\rkeyConditions\"y\n\x17TransactionContinueList\x12\x1d\n\ntoken_data\x18\x01 \x01(\x0cR\ttokenData\x12?\n\tdirection\x18\x04 \x01(\x0e\x32!.stately.db.ContinueListDirectionR\tdirection\"9\n\x0eTransactionPut\x12\'\n\x04puts\x18\x01 \x03(\x0b\x32\x13.stately.db.PutItemR\x04puts\"E\n\x11TransactionDelete\x12\x30\n\x07\x64\x65letes\x18\x01 \x03(\x0b\x32\x16.stately.db.DeleteItemR\x07\x64\x65letes\"@\n\x16TransactionGetResponse\x12&\n\x05items\x18\x01 \x03(\x0b\x32\x10.stately.db.ItemR\x05items\"D\n\x0bGeneratedID\x12\x14\n\x04uint\x18\x01 \x01(\x04H\x00R\x04uint\x12\x16\n\x05\x62ytes\x18\x02 \x01(\x0cH\x00R\x05\x62ytesB\x07\n\x05value\"Q\n\x11TransactionPutAck\x12<\n\rgenerated_ids\x18\x01 \x03(\x0b\x32\x17.stately.db.GeneratedIDR\x0cgeneratedIds\"\x96\x01\n\x17TransactionListResponse\x12\x37\n\x06result\x18\x01 \x01(\x0b\x32\x1d.stately.db.ListPartialResultH\x00R\x06result\x12\x36\n\x08\x66inished\x18\x02 \x01(\x0b\x32\x18.stately.db.ListFinishedH\x00R\x08\x66inishedB\n\n\x08response\"\xa7\x01\n\x13TransactionFinished\x12\x1c\n\tcommitted\x18\x01 \x01(\x08R\tcommitted\x12\x31\n\x0bput_results\x18\x02 \x03(\x0b\x32\x10.stately.db.ItemR\nputResults\x12?\n\x0e\x64\x65lete_results\x18\x03 \x03(\x0b\x32\x18.stately.db.DeleteResultR\rdeleteResultsBk\n\x0e\x63om.stately.dbB\x10TransactionProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
|
19
19
|
|
20
20
|
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
21
21
|
pool.add_serialized_file(descriptor_data)
|
data/lib/key_path.rb
CHANGED
@@ -47,7 +47,8 @@ module StatelyDB
|
|
47
47
|
new.with(namespace, identifier)
|
48
48
|
end
|
49
49
|
|
50
|
-
# If the value is a binary string, encode it as a url-safe
|
50
|
+
# If the value is a binary string, encode it as a url-safe
|
51
|
+
# base64 string with padding removed.
|
51
52
|
#
|
52
53
|
# @param value [String, StatelyDB::UUID, #to_s] The value to convert to a key id.
|
53
54
|
# @return [String]
|
data/lib/statelydb.rb
CHANGED
@@ -127,7 +127,18 @@ module StatelyDB
|
|
127
127
|
# @param prefix [String] the prefix to list
|
128
128
|
# @param limit [Integer] the maximum number of items to return
|
129
129
|
# @param sort_property [String] the property to sort by
|
130
|
-
# @param sort_direction [Symbol] the direction to sort by (:ascending or :descending)
|
130
|
+
# @param sort_direction [Symbol, String, Integer] the direction to sort by (:ascending or :descending)
|
131
|
+
# @param item_types [Array<Class, String>] the item types to filter by. The returned
|
132
|
+
# items will be instances of one of these types.
|
133
|
+
# @param gt [StatelyDB::KeyPath | String] filters results to only include items with a key greater than the
|
134
|
+
# specified value based on lexicographic ordering.
|
135
|
+
# @param gte [StatelyDB::KeyPath | String] filters results to only include items with a key greater than or equal to the
|
136
|
+
# specified value based on lexicographic ordering.
|
137
|
+
# @param lt [StatelyDB::KeyPath | String] filters results to only include items with a key less than the
|
138
|
+
# specified value based on lexicographic ordering.
|
139
|
+
# @param lte [StatelyDB::KeyPath | String] filters results to only include items with a key less than or equal to the
|
140
|
+
# specified value based on lexicographic ordering.
|
141
|
+
|
131
142
|
# @return [Array<StatelyDB::Item>, StatelyDB::Token] the list of Items and the token
|
132
143
|
#
|
133
144
|
# @example
|
@@ -135,15 +146,32 @@ module StatelyDB
|
|
135
146
|
def begin_list(prefix,
|
136
147
|
limit: 100,
|
137
148
|
sort_property: nil,
|
138
|
-
sort_direction: :ascending
|
149
|
+
sort_direction: :ascending,
|
150
|
+
item_types: [],
|
151
|
+
gt: nil,
|
152
|
+
gte: nil,
|
153
|
+
lt: nil,
|
154
|
+
lte: nil)
|
139
155
|
sort_direction = sort_direction == :ascending ? 0 : 1
|
140
|
-
|
156
|
+
key_condition_params = [
|
157
|
+
[Stately::Db::Operator::OPERATOR_GREATER_THAN, gt.is_a?(String) ? gt : gt&.to_s],
|
158
|
+
[Stately::Db::Operator::OPERATOR_GREATER_THAN_OR_EQUAL, gte.is_a?(String) ? gte : gte&.to_s],
|
159
|
+
[Stately::Db::Operator::OPERATOR_LESS_THAN, lt.is_a?(String) ? lt : lt&.to_s],
|
160
|
+
[Stately::Db::Operator::OPERATOR_LESS_THAN_OR_EQUAL, lte.is_a?(String) ? lte : lte&.to_s]
|
161
|
+
]
|
162
|
+
key_conditions = key_condition_params
|
163
|
+
.reject { |(_, value)| value.nil? }
|
164
|
+
.map { |(operator, key_path)| Stately::Db::KeyCondition.new(operator: operator, key_path: key_path) }
|
141
165
|
req = Stately::Db::BeginListRequest.new(
|
142
166
|
store_id: @store_id,
|
143
167
|
key_path_prefix: String(prefix),
|
144
168
|
limit:,
|
145
169
|
sort_property:,
|
146
170
|
sort_direction:,
|
171
|
+
filter_conditions: item_types.map do |item_type|
|
172
|
+
Stately::Db::FilterCondition.new(item_type: item_type.respond_to?(:name) ? item_type.name.split("::").last : item_type)
|
173
|
+
end,
|
174
|
+
key_conditions: key_conditions,
|
147
175
|
allow_stale: @allow_stale,
|
148
176
|
schema_id: @schema::SCHEMA_ID,
|
149
177
|
schema_version_id: @schema::SCHEMA_VERSION_ID
|
@@ -334,6 +334,17 @@ module StatelyDB
|
|
334
334
|
# @param limit [Integer] the maximum number of items to return
|
335
335
|
# @param sort_property [String] the property to sort by
|
336
336
|
# @param sort_direction [Symbol] the direction to sort by (:ascending or :descending)
|
337
|
+
# @param item_types [Array<Class, String>] the item types to filter by. The returned
|
338
|
+
# items will be instances of one of these types.
|
339
|
+
# @param gt [StatelyDB::KeyPath | String] filters results to only include items with a key greater than the
|
340
|
+
# specified value based on lexicographic ordering.
|
341
|
+
# @param gte [StatelyDB::KeyPath | String] filters results to only include items with a key greater than or equal to the
|
342
|
+
# specified value based on lexicographic ordering.
|
343
|
+
# @param lt [StatelyDB::KeyPath | String] filters results to only include items with a key less than the
|
344
|
+
# specified value based on lexicographic ordering.
|
345
|
+
# @param lte [StatelyDB::KeyPath | String] filters results to only include items with a key less than or equal to the
|
346
|
+
# specified value based on lexicographic ordering.
|
347
|
+
|
337
348
|
# @return [Array(Array<StatelyDB::Item>, ::Stately::Db::ListToken)] the list of Items and the token
|
338
349
|
#
|
339
350
|
# Example:
|
@@ -344,19 +355,42 @@ module StatelyDB
|
|
344
355
|
def begin_list(prefix,
|
345
356
|
limit: 100,
|
346
357
|
sort_property: nil,
|
347
|
-
sort_direction: :ascending
|
358
|
+
sort_direction: :ascending,
|
359
|
+
item_types: [],
|
360
|
+
gt: nil,
|
361
|
+
gte: nil,
|
362
|
+
lt: nil,
|
363
|
+
lte: nil)
|
348
364
|
sort_direction = case sort_direction
|
349
365
|
when :ascending
|
350
366
|
0
|
351
367
|
else
|
352
368
|
1
|
353
369
|
end
|
370
|
+
key_condition_params = [
|
371
|
+
[Stately::Db::Operator::OPERATOR_GREATER_THAN, gt.is_a?(String) ? gt : gt&.to_s],
|
372
|
+
[Stately::Db::Operator::OPERATOR_GREATER_THAN_OR_EQUAL, gte.is_a?(String) ? gte : gte&.to_s],
|
373
|
+
[Stately::Db::Operator::OPERATOR_LESS_THAN, lt.is_a?(String) ? lt : lt&.to_s],
|
374
|
+
[Stately::Db::Operator::OPERATOR_LESS_THAN_OR_EQUAL, lte.is_a?(String) ? lte : lte&.to_s]
|
375
|
+
]
|
376
|
+
key_conditions = key_condition_params
|
377
|
+
.reject { |(_, value)| value.nil? }
|
378
|
+
.map do |(operator, key_path)|
|
379
|
+
Stately::Db::KeyCondition.new(operator: operator,
|
380
|
+
key_path: key_path)
|
381
|
+
end
|
354
382
|
req = Stately::Db::TransactionRequest.new(
|
355
383
|
begin_list: Stately::Db::TransactionBeginList.new(
|
356
384
|
key_path_prefix: String(prefix),
|
357
385
|
limit:,
|
358
386
|
sort_property:,
|
359
|
-
sort_direction
|
387
|
+
sort_direction:,
|
388
|
+
filter_conditions: item_types.map do |item_type|
|
389
|
+
Stately::Db::FilterCondition.new(
|
390
|
+
item_type: item_type.respond_to?(:name) ? item_type.name.split("::").last : item_type
|
391
|
+
)
|
392
|
+
end,
|
393
|
+
key_conditions: key_conditions
|
360
394
|
)
|
361
395
|
)
|
362
396
|
do_list_request_response(req)
|
data/lib/version.rb
CHANGED
data/rbi/db/transaction_pb.rbi
CHANGED
@@ -619,7 +619,8 @@ class Stately::Db::TransactionBeginList
|
|
619
619
|
limit: T.nilable(Integer),
|
620
620
|
sort_property: T.nilable(T.any(Symbol, String, Integer)),
|
621
621
|
sort_direction: T.nilable(T.any(Symbol, String, Integer)),
|
622
|
-
filter_conditions: T.nilable(T::Array[T.nilable(Stately::Db::FilterCondition)])
|
622
|
+
filter_conditions: T.nilable(T::Array[T.nilable(Stately::Db::FilterCondition)]),
|
623
|
+
key_conditions: T.nilable(T::Array[T.nilable(Stately::Db::KeyCondition)])
|
623
624
|
).void
|
624
625
|
end
|
625
626
|
def initialize(
|
@@ -627,7 +628,8 @@ class Stately::Db::TransactionBeginList
|
|
627
628
|
limit: 0,
|
628
629
|
sort_property: :SORTABLE_PROPERTY_KEY_PATH,
|
629
630
|
sort_direction: :SORT_ASCENDING,
|
630
|
-
filter_conditions: []
|
631
|
+
filter_conditions: [],
|
632
|
+
key_conditions: []
|
631
633
|
)
|
632
634
|
end
|
633
635
|
|
@@ -730,6 +732,102 @@ class Stately::Db::TransactionBeginList
|
|
730
732
|
def clear_filter_conditions
|
731
733
|
end
|
732
734
|
|
735
|
+
# key_conditions are a set of conditions to apply to the list operation.
|
736
|
+
# Wherever possible, Stately will apply these key conditions at the DB layer
|
737
|
+
# to optimize the list operation cost.
|
738
|
+
#
|
739
|
+
# A maximum of two key conditions are allowed, one with a GREATER_THAN (or equal to)
|
740
|
+
# operator and one with a LESS_THAN (or equal to) operator. Together these amount to
|
741
|
+
# a "between" condition on the key path.
|
742
|
+
#
|
743
|
+
# If these conditions are provided they must share the same prefix as the
|
744
|
+
# key_path_prefix. For example this is valid:
|
745
|
+
#
|
746
|
+
# key_path_prefix: "/group-:groupID/namespace"
|
747
|
+
# key_conditions:
|
748
|
+
# - key_path: "/group-:groupID/namespace-44"
|
749
|
+
# operator: GREATER_THAN_OR_EQUAL
|
750
|
+
# - key_path: "/group-:groupID/namespace-100"
|
751
|
+
# operator: LESS_THAN_OR_EQUAL
|
752
|
+
#
|
753
|
+
# A key_path_prefix of "/group-:groupID" would also be valid above, as the prefix is shared
|
754
|
+
# with the key conditions.
|
755
|
+
#
|
756
|
+
# The following is NOT valid because the key_path_prefix does not
|
757
|
+
# share the same prefix as the key conditions:
|
758
|
+
#
|
759
|
+
# key_path_prefix: "/group-:groupID/namespace"
|
760
|
+
# key_conditions:
|
761
|
+
# - key_path: "/group-:groupID/beatles-1984"
|
762
|
+
# operator: GREATER_THAN_OR_EQUAL
|
763
|
+
sig { returns(T::Array[T.nilable(Stately::Db::KeyCondition)]) }
|
764
|
+
def key_conditions
|
765
|
+
end
|
766
|
+
|
767
|
+
# key_conditions are a set of conditions to apply to the list operation.
|
768
|
+
# Wherever possible, Stately will apply these key conditions at the DB layer
|
769
|
+
# to optimize the list operation cost.
|
770
|
+
#
|
771
|
+
# A maximum of two key conditions are allowed, one with a GREATER_THAN (or equal to)
|
772
|
+
# operator and one with a LESS_THAN (or equal to) operator. Together these amount to
|
773
|
+
# a "between" condition on the key path.
|
774
|
+
#
|
775
|
+
# If these conditions are provided they must share the same prefix as the
|
776
|
+
# key_path_prefix. For example this is valid:
|
777
|
+
#
|
778
|
+
# key_path_prefix: "/group-:groupID/namespace"
|
779
|
+
# key_conditions:
|
780
|
+
# - key_path: "/group-:groupID/namespace-44"
|
781
|
+
# operator: GREATER_THAN_OR_EQUAL
|
782
|
+
# - key_path: "/group-:groupID/namespace-100"
|
783
|
+
# operator: LESS_THAN_OR_EQUAL
|
784
|
+
#
|
785
|
+
# A key_path_prefix of "/group-:groupID" would also be valid above, as the prefix is shared
|
786
|
+
# with the key conditions.
|
787
|
+
#
|
788
|
+
# The following is NOT valid because the key_path_prefix does not
|
789
|
+
# share the same prefix as the key conditions:
|
790
|
+
#
|
791
|
+
# key_path_prefix: "/group-:groupID/namespace"
|
792
|
+
# key_conditions:
|
793
|
+
# - key_path: "/group-:groupID/beatles-1984"
|
794
|
+
# operator: GREATER_THAN_OR_EQUAL
|
795
|
+
sig { params(value: ::Google::Protobuf::RepeatedField).void }
|
796
|
+
def key_conditions=(value)
|
797
|
+
end
|
798
|
+
|
799
|
+
# key_conditions are a set of conditions to apply to the list operation.
|
800
|
+
# Wherever possible, Stately will apply these key conditions at the DB layer
|
801
|
+
# to optimize the list operation cost.
|
802
|
+
#
|
803
|
+
# A maximum of two key conditions are allowed, one with a GREATER_THAN (or equal to)
|
804
|
+
# operator and one with a LESS_THAN (or equal to) operator. Together these amount to
|
805
|
+
# a "between" condition on the key path.
|
806
|
+
#
|
807
|
+
# If these conditions are provided they must share the same prefix as the
|
808
|
+
# key_path_prefix. For example this is valid:
|
809
|
+
#
|
810
|
+
# key_path_prefix: "/group-:groupID/namespace"
|
811
|
+
# key_conditions:
|
812
|
+
# - key_path: "/group-:groupID/namespace-44"
|
813
|
+
# operator: GREATER_THAN_OR_EQUAL
|
814
|
+
# - key_path: "/group-:groupID/namespace-100"
|
815
|
+
# operator: LESS_THAN_OR_EQUAL
|
816
|
+
#
|
817
|
+
# A key_path_prefix of "/group-:groupID" would also be valid above, as the prefix is shared
|
818
|
+
# with the key conditions.
|
819
|
+
#
|
820
|
+
# The following is NOT valid because the key_path_prefix does not
|
821
|
+
# share the same prefix as the key conditions:
|
822
|
+
#
|
823
|
+
# key_path_prefix: "/group-:groupID/namespace"
|
824
|
+
# key_conditions:
|
825
|
+
# - key_path: "/group-:groupID/beatles-1984"
|
826
|
+
# operator: GREATER_THAN_OR_EQUAL
|
827
|
+
sig { void }
|
828
|
+
def clear_key_conditions
|
829
|
+
end
|
830
|
+
|
733
831
|
sig { params(field: String).returns(T.untyped) }
|
734
832
|
def [](field)
|
735
833
|
end
|
data/rbi/statelydb.rbi
CHANGED
@@ -182,7 +182,8 @@ module StatelyDB
|
|
182
182
|
sig { params(namespace: String, identifier: T.nilable(T.any(String, StatelyDB::UUID, T.untyped))).returns(StatelyDB::KeyPath) }
|
183
183
|
def self.with(namespace, identifier = nil); end
|
184
184
|
|
185
|
-
# If the value is a binary string, encode it as a url-safe
|
185
|
+
# If the value is a binary string, encode it as a url-safe
|
186
|
+
# base64 string with padding removed.
|
186
187
|
#
|
187
188
|
# _@param_ `value` — The value to convert to a key id.
|
188
189
|
sig { params(value: T.any(String, StatelyDB::UUID, T.untyped)).returns(String) }
|
@@ -259,16 +260,6 @@ module StatelyDB
|
|
259
260
|
sig { params(key_paths: T.any(String, T::Array[String])).returns(T.any(T::Array[StatelyDB::Item], NilClass)) }
|
260
261
|
def get_batch(*key_paths); end
|
261
262
|
|
262
|
-
# Begin listing Items from a StatelyDB Store at the given prefix.
|
263
|
-
#
|
264
|
-
# _@param_ `prefix` — the prefix to list
|
265
|
-
#
|
266
|
-
# _@param_ `limit` — the maximum number of items to return
|
267
|
-
#
|
268
|
-
# _@param_ `sort_property` — the property to sort by
|
269
|
-
#
|
270
|
-
# _@param_ `sort_direction` — the direction to sort by (:ascending or :descending)
|
271
|
-
#
|
272
263
|
# _@return_ — the list of Items and the token
|
273
264
|
#
|
274
265
|
# ```ruby
|
@@ -276,13 +267,18 @@ module StatelyDB
|
|
276
267
|
# ```
|
277
268
|
sig do
|
278
269
|
params(
|
279
|
-
prefix:
|
280
|
-
limit:
|
281
|
-
sort_property: T.
|
282
|
-
sort_direction:
|
270
|
+
prefix: T.untyped,
|
271
|
+
limit: T.untyped,
|
272
|
+
sort_property: T.untyped,
|
273
|
+
sort_direction: T.untyped,
|
274
|
+
item_types: T.untyped,
|
275
|
+
gt: T.untyped,
|
276
|
+
gte: T.untyped,
|
277
|
+
lt: T.untyped,
|
278
|
+
lte: T.untyped
|
283
279
|
).returns(T.any(T::Array[StatelyDB::Item], StatelyDB::Token))
|
284
280
|
end
|
285
|
-
def begin_list(prefix, limit: 100, sort_property: nil, sort_direction: :ascending); end
|
281
|
+
def begin_list(prefix, limit: 100, sort_property: nil, sort_direction: :ascending, item_types: [], gt: nil, gte: nil, lt: nil, lte: nil); end
|
286
282
|
|
287
283
|
# Continue listing Items from a StatelyDB Store using a token.
|
288
284
|
#
|
@@ -1010,32 +1006,27 @@ module StatelyDB
|
|
1010
1006
|
sig { params(key_paths: T.any(String, T::Array[String])).void }
|
1011
1007
|
def delete(*key_paths); end
|
1012
1008
|
|
1013
|
-
# Begin listing Items from a StatelyDB Store at the given prefix.
|
1014
|
-
#
|
1015
1009
|
# Example:
|
1016
1010
|
# client.data.transaction do |txn|
|
1017
1011
|
# (items, token) = txn.begin_list("/ItemType-identifier")
|
1018
1012
|
# (items, token) = txn.continue_list(token)
|
1019
1013
|
# end
|
1020
1014
|
#
|
1021
|
-
# _@param_ `prefix` — the prefix to list
|
1022
|
-
#
|
1023
|
-
# _@param_ `limit` — the maximum number of items to return
|
1024
|
-
#
|
1025
|
-
# _@param_ `sort_property` — the property to sort by
|
1026
|
-
#
|
1027
|
-
# _@param_ `sort_direction` — the direction to sort by (:ascending or :descending)
|
1028
|
-
#
|
1029
1015
|
# _@return_ — the list of Items and the token
|
1030
1016
|
sig do
|
1031
1017
|
params(
|
1032
|
-
prefix:
|
1033
|
-
limit:
|
1034
|
-
sort_property: T.
|
1035
|
-
sort_direction:
|
1018
|
+
prefix: T.untyped,
|
1019
|
+
limit: T.untyped,
|
1020
|
+
sort_property: T.untyped,
|
1021
|
+
sort_direction: T.untyped,
|
1022
|
+
item_types: T.untyped,
|
1023
|
+
gt: T.untyped,
|
1024
|
+
gte: T.untyped,
|
1025
|
+
lt: T.untyped,
|
1026
|
+
lte: T.untyped
|
1036
1027
|
).returns([T::Array[StatelyDB::Item], ::Stately::Db::ListToken])
|
1037
1028
|
end
|
1038
|
-
def begin_list(prefix, limit: 100, sort_property: nil, sort_direction: :ascending); end
|
1029
|
+
def begin_list(prefix, limit: 100, sort_property: nil, sort_direction: :ascending, item_types: [], gt: nil, gte: nil, lt: nil, lte: nil); end
|
1039
1030
|
|
1040
1031
|
# Continue listing Items from a StatelyDB Store using a token.
|
1041
1032
|
#
|
data/sig/statelydb.rbs
CHANGED
@@ -151,7 +151,8 @@ module StatelyDB
|
|
151
151
|
# ```
|
152
152
|
def self.with: (String namespace, ?(String | StatelyDB::UUID | _ToS)? identifier) -> StatelyDB::KeyPath
|
153
153
|
|
154
|
-
# If the value is a binary string, encode it as a url-safe
|
154
|
+
# If the value is a binary string, encode it as a url-safe
|
155
|
+
# base64 string with padding removed.
|
155
156
|
#
|
156
157
|
# _@param_ `value` — The value to convert to a key id.
|
157
158
|
def self.to_key_id: ((String | StatelyDB::UUID | _ToS) value) -> String
|
@@ -220,26 +221,21 @@ module StatelyDB
|
|
220
221
|
# ```
|
221
222
|
def get_batch: (*(String | ::Array[String]) key_paths) -> (::Array[StatelyDB::Item] | NilClass)
|
222
223
|
|
223
|
-
# Begin listing Items from a StatelyDB Store at the given prefix.
|
224
|
-
#
|
225
|
-
# _@param_ `prefix` — the prefix to list
|
226
|
-
#
|
227
|
-
# _@param_ `limit` — the maximum number of items to return
|
228
|
-
#
|
229
|
-
# _@param_ `sort_property` — the property to sort by
|
230
|
-
#
|
231
|
-
# _@param_ `sort_direction` — the direction to sort by (:ascending or :descending)
|
232
|
-
#
|
233
224
|
# _@return_ — the list of Items and the token
|
234
225
|
#
|
235
226
|
# ```ruby
|
236
227
|
# client.data.begin_list("/ItemType-identifier", limit: 10, sort_direction: :ascending)
|
237
228
|
# ```
|
238
229
|
def begin_list: (
|
239
|
-
|
240
|
-
?limit:
|
241
|
-
?sort_property:
|
242
|
-
?sort_direction:
|
230
|
+
untyped prefix,
|
231
|
+
?limit: untyped,
|
232
|
+
?sort_property: untyped,
|
233
|
+
?sort_direction: untyped,
|
234
|
+
?item_types: untyped,
|
235
|
+
?gt: untyped,
|
236
|
+
?gte: untyped,
|
237
|
+
?lt: untyped,
|
238
|
+
?lte: untyped
|
243
239
|
) -> (::Array[StatelyDB::Item] | StatelyDB::Token)
|
244
240
|
|
245
241
|
# Continue listing Items from a StatelyDB Store using a token.
|
@@ -891,28 +887,23 @@ module StatelyDB
|
|
891
887
|
# _@return_ — nil
|
892
888
|
def delete: (*(String | ::Array[String]) key_paths) -> void
|
893
889
|
|
894
|
-
# Begin listing Items from a StatelyDB Store at the given prefix.
|
895
|
-
#
|
896
890
|
# Example:
|
897
891
|
# client.data.transaction do |txn|
|
898
892
|
# (items, token) = txn.begin_list("/ItemType-identifier")
|
899
893
|
# (items, token) = txn.continue_list(token)
|
900
894
|
# end
|
901
895
|
#
|
902
|
-
# _@param_ `prefix` — the prefix to list
|
903
|
-
#
|
904
|
-
# _@param_ `limit` — the maximum number of items to return
|
905
|
-
#
|
906
|
-
# _@param_ `sort_property` — the property to sort by
|
907
|
-
#
|
908
|
-
# _@param_ `sort_direction` — the direction to sort by (:ascending or :descending)
|
909
|
-
#
|
910
896
|
# _@return_ — the list of Items and the token
|
911
897
|
def begin_list: (
|
912
|
-
|
913
|
-
?limit:
|
914
|
-
?sort_property:
|
915
|
-
?sort_direction:
|
898
|
+
untyped prefix,
|
899
|
+
?limit: untyped,
|
900
|
+
?sort_property: untyped,
|
901
|
+
?sort_direction: untyped,
|
902
|
+
?item_types: untyped,
|
903
|
+
?gt: untyped,
|
904
|
+
?gte: untyped,
|
905
|
+
?lt: untyped,
|
906
|
+
?lte: untyped
|
916
907
|
) -> [::Array[StatelyDB::Item], ::Stately::Db::ListToken]
|
917
908
|
|
918
909
|
# Continue listing Items from a StatelyDB Store using a token.
|
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.29.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-06-
|
11
|
+
date: 2025-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0'
|
154
154
|
requirements: []
|
155
|
-
rubygems_version: 3.
|
155
|
+
rubygems_version: 3.4.19
|
156
156
|
signing_key:
|
157
157
|
specification_version: 4
|
158
158
|
summary: A library for interacting with StatelyDB
|