changeset 3753:10b71e3526bd

core (memory/sqla): add attribute to filter on `item_ids` in `getItems`
author Goffi <goffi@goffi.org>
date Fri, 13 May 2022 17:58:51 +0200
parents 5f546dd910e0
children af485e8afe03
files sat/memory/sqla.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sat/memory/sqla.py	Fri May 13 17:57:24 2022 +0200
+++ b/sat/memory/sqla.py	Fri May 13 17:58:51 2022 +0200
@@ -1224,6 +1224,7 @@
         self,
         node: PubsubNode,
         max_items: Optional[int] = None,
+        item_ids: Optional[list[str]] = None,
         before: Optional[str] = None,
         after: Optional[str] = None,
         from_index: Optional[int] = None,
@@ -1279,6 +1280,9 @@
             .limit(max_items)
         )
 
+        if item_ids is not None:
+            stmt = stmt.where(PubsubItem.name.in_(item_ids))
+
         if not order_by:
             order_by = [C.ORDER_BY_MODIFICATION]