FOSSredder 0.5.0
Loading...
Searching...
No Matches
SqliteAnnualRepository Class Reference

#include <SqliteAnnualRepository.h>

Inheritance diagram for SqliteAnnualRepository:
Collaboration diagram for SqliteAnnualRepository:

Classes

struct  Impl

Public Member Functions

 SqliteAnnualRepository (const std::string &dbPath)
 Create an annual repository for the database at the given path.
 SqliteAnnualRepository (std::shared_ptr< SqliteDb > db)
 Create an annual repository using an existing database handle wrapper.
 ~SqliteAnnualRepository () override
 Destroy the repository.
void addAnnual (const std::shared_ptr< core::domain::Annual > &annual) override
 Insert a new annual entry.
std::vector< std::shared_ptr< core::domain::Annual > > getAnnuals () const override
 Retrieve all annual entries.
std::optional< std::shared_ptr< core::domain::Annual > > getAnnualById (const std::string &id) const override
 Retrieve an annual entry by identifier.
void removeAnnual (const std::string &id) override
 Remove an annual entry by identifier.
void updateAnnual (const std::shared_ptr< core::domain::Annual > &annual) override
 Update an existing annual entry.
void upsertAnnual (const std::shared_ptr< core::domain::Annual > &annual) override
 Insert or update an annual entry.
void clearAnnuals () override
 Remove all annual entries.
sqlite3 * sqliteHandle () const noexcept override
 Return the SQLite handle.
Public Member Functions inherited from core::ports::repositories::IAnnualRepository
virtual ~IAnnualRepository ()=default
 Destroy the annual repository interface.
Public Member Functions inherited from ISqlConnectionProvider
virtual ~ISqlConnectionProvider ()=default

Detailed Description

Definition at line 16 of file SqliteAnnualRepository.h.

Constructor & Destructor Documentation

◆ SqliteAnnualRepository() [1/2]

SqliteAnnualRepository::SqliteAnnualRepository ( const std::string & dbPath)
explicit

Create an annual repository for the database at the given path.

Parameters
dbPathSQLite database path.

Definition at line 90 of file SqliteAnnualRepository.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SqliteAnnualRepository() [2/2]

SqliteAnnualRepository::SqliteAnnualRepository ( std::shared_ptr< SqliteDb > db)
explicit

Create an annual repository using an existing database handle wrapper.

Parameters
dbShared SQLite database wrapper.

Definition at line 93 of file SqliteAnnualRepository.cpp.

◆ ~SqliteAnnualRepository()

SqliteAnnualRepository::~SqliteAnnualRepository ( )
overridedefault

Destroy the repository.

Member Function Documentation

◆ addAnnual()

void SqliteAnnualRepository::addAnnual ( const std::shared_ptr< core::domain::Annual > & annual)
overridevirtual

Insert a new annual entry.

Parameters
annualAnnual to add.

Implements core::ports::repositories::IAnnualRepository.

Definition at line 104 of file SqliteAnnualRepository.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearAnnuals()

void SqliteAnnualRepository::clearAnnuals ( )
overridevirtual

Remove all annual entries.

Implements core::ports::repositories::IAnnualRepository.

Definition at line 200 of file SqliteAnnualRepository.cpp.

◆ getAnnualById()

std::optional< std::shared_ptr< Annual > > SqliteAnnualRepository::getAnnualById ( const std::string & id) const
overridevirtual

Retrieve an annual entry by identifier.

Parameters
idAnnual identifier.
Returns
Annual with the requested identifier, if found.

Implements core::ports::repositories::IAnnualRepository.

Definition at line 141 of file SqliteAnnualRepository.cpp.

Here is the call graph for this function:

◆ getAnnuals()

std::vector< std::shared_ptr< Annual > > SqliteAnnualRepository::getAnnuals ( ) const
overridevirtual

Retrieve all annual entries.

Returns
All stored annual entries.

Implements core::ports::repositories::IAnnualRepository.

Definition at line 126 of file SqliteAnnualRepository.cpp.

Here is the call graph for this function:

◆ removeAnnual()

void SqliteAnnualRepository::removeAnnual ( const std::string & id)
overridevirtual

Remove an annual entry by identifier.

Parameters
idAnnual identifier.

Implements core::ports::repositories::IAnnualRepository.

Definition at line 156 of file SqliteAnnualRepository.cpp.

Here is the call graph for this function:

◆ sqliteHandle()

sqlite3 * SqliteAnnualRepository::sqliteHandle ( ) const
overridevirtualnoexcept

Return the SQLite handle.

Returns
SQLite database handle.

Implements ISqlConnectionProvider.

Definition at line 209 of file SqliteAnnualRepository.cpp.

◆ updateAnnual()

void SqliteAnnualRepository::updateAnnual ( const std::shared_ptr< core::domain::Annual > & annual)
overridevirtual

Update an existing annual entry.

Parameters
annualAnnual to update.

Implements core::ports::repositories::IAnnualRepository.

Definition at line 167 of file SqliteAnnualRepository.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ upsertAnnual()

void SqliteAnnualRepository::upsertAnnual ( const std::shared_ptr< core::domain::Annual > & annual)
overridevirtual

Insert or update an annual entry.

Parameters
annualAnnual to upsert.

Implements core::ports::repositories::IAnnualRepository.

Definition at line 188 of file SqliteAnnualRepository.cpp.

Here is the call graph for this function:

The documentation for this class was generated from the following files: