Mercurial > libervia-backend
changeset 3079:f8cc88c773c8
core (memory/sqlite): added `before_uid` filter to retrieve history before a message UID
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 05 Dec 2019 22:58:06 +0100 |
parents | 95c94d94872d |
children | 16925f494820 |
files | sat/bridge/bridge_constructor/bridge_template.ini sat/memory/sqlite.py |
diffstat | 2 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/sat/bridge/bridge_constructor/bridge_template.ini Mon Nov 18 22:34:13 2019 +0100 +++ b/sat/bridge/bridge_constructor/bridge_template.ini Thu Dec 05 22:58:06 2019 +0100 @@ -655,6 +655,7 @@ - search: pattern must be in message body or source resource - types: type must be one of those, values are separated by spaces - not_types: type must not be one of those, values are separated by spaces + - before_uid: check only message received before message with given uid doc_param_5=%(doc_profile)s doc_return=Ordered list (by timestamp) of data as in [messageNew] (without final profile)
--- a/sat/memory/sqlite.py Mon Nov 18 22:34:13 2019 +0100 +++ b/sat/memory/sqlite.py Thu Dec 05 22:58:06 2019 +0100 @@ -625,6 +625,9 @@ if 'timestamp_start' in filters: query_parts.append("AND timestamp>= ?") values.append(float(filters['timestamp_start'])) + if 'before_uid' in filters: + query_parts.append("AND history.rowid<(select rowid from history where uid=?)") + values.append(filters['before_uid']) if 'body' in filters: # TODO: use REGEXP (function to be defined) instead of GLOB: https://www.sqlite.org/lang_expr.html query_parts.append("AND message LIKE ?")