ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
account_repository Class Reference

Reads and writes accounts off of data storage. More...

#include <account_repository.hpp>

Collaboration diagram for account_repository:
Collaboration graph

Public Types

using context = ores::database::context
 

Public Member Functions

 account_repository (context ctx)
 
std::string sql ()
 Returns the SQL created by sqlgen to construct the table.
 
std::vector< domain::accountread_latest (std::uint32_t offset, std::uint32_t limit)
 Reads latest accounts with pagination support.
 
std::uint32_t get_total_account_count ()
 Gets the total count of active accounts.
 
std::vector< domain::accountread_latest_by_username (const std::string &username)
 Reads the latest account by username.
 
std::vector< domain::accountread_latest_by_email (const std::string &email)
 Reads the latest account by email.
 
void remove (const boost::uuids::uuid &account_id)
 Deletes an account by closing its temporal validity.
 
void write (const domain::account &account)
 Writes accounts to database. Expects the account set to have unique IDs.
 
void write (const std::vector< domain::account > &accounts)
 
std::vector< domain::accountread_latest ()
 Reads latest accounts, possibly filtered by ID.
 
std::vector< domain::accountread_latest (const boost::uuids::uuid &id)
 
std::vector< domain::accountread_all ()
 Reads all accounts, possibly filtered by ID.
 
std::vector< domain::accountread_all (const boost::uuids::uuid &id)
 

Detailed Description

Reads and writes accounts off of data storage.

Member Function Documentation

◆ read_latest()

std::vector< domain::account > read_latest ( std::uint32_t  offset,
std::uint32_t  limit 
)

Reads latest accounts with pagination support.

Parameters
offsetNumber of records to skip
limitMaximum number of records to return
Returns
Vector of accounts within the specified range

◆ get_total_account_count()

std::uint32_t get_total_account_count ( )

Gets the total count of active accounts.

Returns
Total number of accounts with valid_to == max_timestamp
Here is the caller graph for this function:

◆ remove()

void remove ( const boost::uuids::uuid &  account_id)

Deletes an account by closing its temporal validity.

Sets the valid_to timestamp to now, effectively "deleting" the account from the current point in time onwards while preserving history.

Here is the caller graph for this function: