Mercurial > prosody-hg
comparison plugins/mod_storage_internal.lua @ 8023:5a9d491cc714
mod_storage_internal: Add the dates method
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 31 Mar 2017 17:49:51 +0200 |
| parents | 05e201468f27 |
| children | 4ba8cb75d925 |
comparison
equal
deleted
inserted
replaced
| 8022:05e201468f27 | 8023:5a9d491cc714 |
|---|---|
| 118 item = st.deserialize(item); | 118 item = st.deserialize(item); |
| 119 return key, item, when, with; | 119 return key, item, when, with; |
| 120 end, count; | 120 end, count; |
| 121 end | 121 end |
| 122 | 122 |
| 123 function archive:dates(username) | |
| 124 local items, err = datamanager.list_load(username, host, self.store); | |
| 125 if not items then return items, err; end | |
| 126 return array(items):pluck("when"):map(datetime.date):unique(); | |
| 127 end | |
| 128 | |
| 123 function archive:delete(username, query) | 129 function archive:delete(username, query) |
| 124 if not query or next(query) == nil then | 130 if not query or next(query) == nil then |
| 125 return datamanager.list_store(username, host, self.store, nil); | 131 return datamanager.list_store(username, host, self.store, nil); |
| 126 end | 132 end |
| 127 for k in pairs(query) do | 133 for k in pairs(query) do |
