Diff

plugins/mod_storage_sql.lua @ 10220:1e2b444acb72

mod_storage_*: Tweak :summary API to allow future expansion with more fields Eg might want to include last message, timestamp, chat state or other info.
author Kim Alvefur <zash@zash.se>
date Fri, 23 Aug 2019 01:04:00 +0200
parent 10033:ca8333d1a7fe
child 10221:068692cb9e78
line wrap: on
line diff
--- a/plugins/mod_storage_sql.lua	Thu Aug 22 01:00:31 2019 +0200
+++ b/plugins/mod_storage_sql.lua	Fri Aug 23 01:04:00 2019 +0200
@@ -446,12 +446,14 @@
 		return engine:select(sql_query, unpack(args));
 	end);
 	if not ok then return ok, result end
-	local summary = {};
+	local counts = {};
 	for row in result do
 		local with, count = row[1], row[2];
-		summary[with] = count;
+		counts[with] = count;
 	end
-	return summary;
+	return {
+		counts = counts;
+	};
 end
 
 function archive_store:delete(username, query)