plugins/mod_storage_sql.lua
changeset 11283 f225070e2b8a
parent 11275 41a962b72a6e
child 11287 f415176281fa
--- a/plugins/mod_storage_sql.lua	Tue Jan 12 18:06:55 2021 +0100
+++ b/plugins/mod_storage_sql.lua	Tue Jan 12 18:46:17 2021 +0100
@@ -283,6 +283,7 @@
 	quota = archive_item_limit;
 	truncate = true;
 	full_id_range = true;
+	ids = true;
 };
 archive_store.__index = archive_store
 function archive_store:append(username, key, value, when, with)
@@ -376,6 +377,15 @@
 		where[#where+1] = "\"key\" = ?";
 		args[#args+1] = query.key
 	end
+
+	-- Set of ids
+	if query.ids then
+		local nids, nargs = #query.ids, #args;
+		where[#where + 1] = "\"key\" IN (" .. string.rep("?", nids, ",") .. ")";
+		for i, id in ipairs(query.ids) do
+			args[nargs+i] = id;
+		end
+	end
 end
 local function archive_where_id_range(query, args, where)
 	-- Before or after specific item, exclusive