|
GitWatcherBot 1.0.0
A Telegram Bot that notifies you when a new change is made in your repositories (issues, pull requests, stars, forks, and watches)
|
#include <Database.hpp>
Static Public Member Functions | |
| static std::mutex & | getDbMutex () noexcept |
| Returns Database mutex to be used by multiple threads for writing/reading into/from the database. | |
| static auto & | getStorage () |
| Returns create database storage. It creates it if not already created, also syncs the db schema. | |
| static void | backup () |
| Call this periodically to backup the database in res/DbBackups/ periodically. | |
| static bool | userExists (const models::UserId userId) |
| Returns true if User with id exists in the database. | |
| static models::User | getUser (const models::UserId userId) |
| Returns User object by id. | |
| static void | addUser (const models::User &newUser) |
| Adds a new user to the database. | |
| static models::UserStatus | getUserStatus (const models::UserId userId) |
| Returns UserStatus by id. | |
| static void | updateUserStatus (const models::UserId userId, const models::UserStatus newStatus) |
| Update User's status by id. | |
| static void | updateUser (const models::User &updatedUser) |
| Updates existing user changed properties. | |
| static int | userReposCount (const models::UserId userId) |
| Returns the count of repositories this user is watching. | |
| static bool | repoExists (const models::RepositoryId repoId) |
| Returns true if a Repository exists with same id. | |
| static bool | repoExistsByFullName (const std::string &full_name) |
| Returns true if Repository exists with same full_name (example: "torvalds/linux") | |
| static void | addRepo (const models::Repository &newRepo) |
| Adds a new Repository object to the database. | |
| static void | updateRepo (const models::Repository &updatedRepo) |
| Updates existing repository changed properties. | |
| static void | removeUserRepo (const models::UserId watcherId, const models::RepositoryId repoId) |
| Removes Repository from User's watch list. | |
| static void | iterateRepos (const std::function< void(const models::Repository &)> &callback) |
| Lock secure iterate over repositories to not hold the db mutex for a long time. | |
| static std::vector< std::string > | getUserReposFullnames (const models::UserId watcherId) |
| Returns full names of all repositories that a User is watching. | |
| static std::vector< models::Repository > | getUserRepos (const models::UserId watcherId) |
| Returns all Repositories objects that a User is watching. | |
| static std::int64_t | addLog (const models::Log &newLog) |
| Adds a new Log object to the database. | |
Definition at line 14 of file Database.hpp.
|
static |
Adds a new Log object to the database.
|
static |
Adds a new Repository object to the database.
|
static |
Adds a new user to the database.
|
static |
Call this periodically to backup the database in res/DbBackups/ periodically.
|
staticnoexcept |
Returns Database mutex to be used by multiple threads for writing/reading into/from the database.
|
inlinestatic |
Returns create database storage. It creates it if not already created, also syncs the db schema.
Definition at line 26 of file Database.hpp.
|
static |
Returns User object by id.
|
static |
Returns all Repositories objects that a User is watching.
|
static |
Returns full names of all repositories that a User is watching.
|
static |
Returns UserStatus by id.
|
static |
Lock secure iterate over repositories to not hold the db mutex for a long time.
|
static |
Removes Repository from User's watch list.
|
static |
Returns true if a Repository exists with same id.
|
static |
Returns true if Repository exists with same full_name (example: "torvalds/linux")
|
static |
Updates existing repository changed properties.
|
static |
Updates existing user changed properties.
|
static |
Update User's status by id.
|
static |
Returns true if User with id exists in the database.
|
static |
Returns the count of repositories this user is watching.