@@ -210,20 +210,25 @@ def find(
210
210
self ,
211
211
id : str ,
212
212
event_context : EventContext ,
213
- peeker : Callable = None ,
214
213
visible_only = True ,
215
214
mapper : Callable = None ,
216
215
):
217
216
partition_key_value = self .find_partition_key_value (event_context )
218
217
found_item = self .container .read_item (id , partition_key_value )
219
- if peeker :
220
- peeker (found_item )
221
-
222
218
function_mapper = self .get_mapper_or_dict (mapper )
223
219
return function_mapper (self .check_visibility (found_item , visible_only ))
224
220
225
- def find_all (self , event_context : EventContext , conditions : dict = {}, custom_sql_conditions : List [str ] = [],
226
- custom_params : dict = {}, max_count = None , offset = 0 , visible_only = True , mapper : Callable = None ):
221
+ def find_all (
222
+ self ,
223
+ event_context : EventContext ,
224
+ conditions : dict = {},
225
+ custom_sql_conditions : List [str ] = [],
226
+ custom_params : dict = {},
227
+ max_count = None ,
228
+ offset = 0 ,
229
+ visible_only = True ,
230
+ mapper : Callable = None ,
231
+ ):
227
232
partition_key_value = self .find_partition_key_value (event_context )
228
233
max_count = self .get_page_size_or (max_count )
229
234
params = [
@@ -242,16 +247,16 @@ def find_all(self, event_context: EventContext, conditions: dict = {}, custom_sq
242
247
{order_clause}
243
248
OFFSET @offset LIMIT @max_count
244
249
""" .format (
245
- partition_key_attribute = self .partition_key_attribute ,
246
- visibility_condition = self .create_sql_condition_for_visibility (
247
- visible_only
248
- ),
249
- conditions_clause = self .create_sql_where_conditions (conditions ),
250
- custom_sql_conditions_clause = self .create_custom_sql_conditions (
251
- custom_sql_conditions
252
- ),
253
- order_clause = self .create_sql_order_clause (),
254
- )
250
+ partition_key_attribute = self .partition_key_attribute ,
251
+ visibility_condition = self .create_sql_condition_for_visibility (
252
+ visible_only
253
+ ),
254
+ conditions_clause = self .create_sql_where_conditions (conditions ),
255
+ custom_sql_conditions_clause = self .create_custom_sql_conditions (
256
+ custom_sql_conditions
257
+ ),
258
+ order_clause = self .create_sql_order_clause (),
259
+ )
255
260
256
261
result = self .container .query_items (
257
262
query = query_str ,
@@ -268,16 +273,11 @@ def partial_update(
268
273
id : str ,
269
274
changes : dict ,
270
275
event_context : EventContext ,
271
- peeker : Callable = None ,
272
276
visible_only = True ,
273
277
mapper : Callable = None ,
274
278
):
275
279
item_data = self .find (
276
- id ,
277
- event_context ,
278
- peeker = peeker ,
279
- visible_only = visible_only ,
280
- mapper = dict ,
280
+ id , event_context , visible_only = visible_only , mapper = dict ,
281
281
)
282
282
item_data .update (changes )
283
283
return self .update (id , item_data , event_context , mapper = mapper )
@@ -295,17 +295,12 @@ def update(
295
295
return function_mapper (self .container .replace_item (id , body = item_data ))
296
296
297
297
def delete (
298
- self ,
299
- id : str ,
300
- event_context : EventContext ,
301
- peeker : Callable = None ,
302
- mapper : Callable = None ,
298
+ self , id : str , event_context : EventContext , mapper : Callable = None ,
303
299
):
304
300
return self .partial_update (
305
301
id ,
306
302
{'deleted' : generate_uuid4 ()},
307
303
event_context ,
308
- peeker = peeker ,
309
304
visible_only = True ,
310
305
mapper = mapper ,
311
306
)
0 commit comments