0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-06-11 15:18:54 +02:00

Move get_user_count_txn out of base store

This commit is contained in:
Erik Johnston 2019-12-04 10:45:59 +00:00
parent a785a2febe
commit 00f0d67566
2 changed files with 12 additions and 12 deletions

View file

@ -1440,18 +1440,6 @@ class SQLBaseStore(object):
return cls.cursor_to_dict(txn)
def get_user_count_txn(self, txn):
"""Get a total number of registered users in the users list.
Args:
txn : Transaction object
Returns:
int : number of users
"""
sql_count = "SELECT COUNT(*) FROM users WHERE is_guest = 0;"
txn.execute(sql_count)
return txn.fetchone()[0]
def _simple_search_list(
self, table, term, col, retcols, desc="_simple_search_list"
):

View file

@ -516,6 +516,18 @@ class DataStore(
retval = {"users": users, "total": count}
return retval
def get_user_count_txn(self, txn):
"""Get a total number of registered users in the users list.
Args:
txn : Transaction object
Returns:
int : number of users
"""
sql_count = "SELECT COUNT(*) FROM users WHERE is_guest = 0;"
txn.execute(sql_count)
return txn.fetchone()[0]
def search_users(self, term):
"""Function to search users list for one or more users with
the matched term.