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

Move things out of SQLBaseStore #6454

Merged
merged 7 commits into from
Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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):
erikjohnston marked this conversation as resolved.
Show resolved Hide resolved
"""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