Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Move get_user_count_txn out of base store
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston committed Dec 4, 2019
1 parent a785a2f commit 00f0d67
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 0 additions & 12 deletions synapse/storage/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1440,18 +1440,6 @@ def _simple_select_list_paginate_txn(

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"
):
Expand Down
12 changes: 12 additions & 0 deletions synapse/storage/data_stores/main/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,18 @@ def get_users_paginate(self, order, start, limit):
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.
Expand Down

0 comments on commit 00f0d67

Please sign in to comment.