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

#include <SqliteStatementRepository.h>

Inheritance diagram for SqliteStatementRepository:
Collaboration diagram for SqliteStatementRepository:

Classes

struct  Impl

Public Member Functions

 SqliteStatementRepository (const std::string &dbPath)
 Create a statement repository for the database at the given path.
 SqliteStatementRepository (const std::string &dbPath, std::shared_ptr< core::ports::diagnostics::IErrorReporter > errorReporter)
 Create a statement repository for the database at the given path.
 SqliteStatementRepository (std::shared_ptr< SqliteDb > db)
 Create a statement repository using an existing database handle wrapper.
 SqliteStatementRepository (std::shared_ptr< SqliteDb > db, std::shared_ptr< core::ports::diagnostics::IErrorReporter > errorReporter)
 Create a statement repository using an existing database handle wrapper.
 ~SqliteStatementRepository () override
 Destroy the repository.
void addStatement (const std::shared_ptr< core::domain::Statement > &statement) override
 Add a new statement.
std::vector< std::shared_ptr< core::domain::Statement > > getStatements () const override
 Retrieve all statements.
std::optional< std::shared_ptr< core::domain::Statement > > getStatementById (const std::string &id) const override
 Retrieve a statement by identifier.
void removeStatement (const std::string &id) override
 Remove a statement by identifier.
void updateStatement (const std::shared_ptr< core::domain::Statement > &statement) override
 Update an existing statement.
void upsertStatement (const std::shared_ptr< core::domain::Statement > &statement) override
 Insert or update a statement.
void clearStatements () override
 Remove all statements.
Public Member Functions inherited from core::ports::repositories::IStatementRepository
virtual ~IStatementRepository ()=default
 Destroy the statement repository interface.

Detailed Description

Definition at line 16 of file SqliteStatementRepository.h.

Constructor & Destructor Documentation

◆ SqliteStatementRepository() [1/4]

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

Create a statement repository for the database at the given path.

Parameters
dbPathSQLite database path.

Definition at line 70 of file SqliteStatementRepository.cpp.

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

◆ SqliteStatementRepository() [2/4]

SqliteStatementRepository::SqliteStatementRepository ( const std::string & dbPath,
std::shared_ptr< core::ports::diagnostics::IErrorReporter > errorReporter )

Create a statement repository for the database at the given path.

Parameters
dbPathSQLite database path.
errorReporterError reporter used by the repository.

Definition at line 73 of file SqliteStatementRepository.cpp.

Here is the call graph for this function:

◆ SqliteStatementRepository() [3/4]

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

Create a statement repository using an existing database handle wrapper.

Parameters
dbShared SQLite database wrapper.

Definition at line 79 of file SqliteStatementRepository.cpp.

Here is the call graph for this function:

◆ SqliteStatementRepository() [4/4]

SqliteStatementRepository::SqliteStatementRepository ( std::shared_ptr< SqliteDb > db,
std::shared_ptr< core::ports::diagnostics::IErrorReporter > errorReporter )

Create a statement repository using an existing database handle wrapper.

Parameters
dbShared SQLite database wrapper.
errorReporterError reporter used by the repository.

Definition at line 83 of file SqliteStatementRepository.cpp.

◆ ~SqliteStatementRepository()

SqliteStatementRepository::~SqliteStatementRepository ( )
overridedefault

Destroy the repository.

Member Function Documentation

◆ addStatement()

void SqliteStatementRepository::addStatement ( const std::shared_ptr< core::domain::Statement > & statement)
overridevirtual

Add a new statement.

Parameters
statementStatement to add.

Implements core::ports::repositories::IStatementRepository.

Definition at line 95 of file SqliteStatementRepository.cpp.

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

◆ clearStatements()

void SqliteStatementRepository::clearStatements ( )
overridevirtual

Remove all statements.

Implements core::ports::repositories::IStatementRepository.

Definition at line 192 of file SqliteStatementRepository.cpp.

◆ getStatementById()

std::optional< std::shared_ptr< Statement > > SqliteStatementRepository::getStatementById ( const std::string & id) const
overridevirtual

Retrieve a statement by identifier.

Parameters
idStatement identifier.
Returns
Statement with the requested identifier, if found.

Implements core::ports::repositories::IStatementRepository.

Definition at line 134 of file SqliteStatementRepository.cpp.

Here is the call graph for this function:

◆ getStatements()

std::vector< std::shared_ptr< Statement > > SqliteStatementRepository::getStatements ( ) const
overridevirtual

Retrieve all statements.

Returns
All stored statements.

Implements core::ports::repositories::IStatementRepository.

Definition at line 114 of file SqliteStatementRepository.cpp.

Here is the call graph for this function:

◆ removeStatement()

void SqliteStatementRepository::removeStatement ( const std::string & id)
overridevirtual

Remove a statement by identifier.

Parameters
idStatement identifier.

Implements core::ports::repositories::IStatementRepository.

Definition at line 154 of file SqliteStatementRepository.cpp.

Here is the call graph for this function:

◆ updateStatement()

void SqliteStatementRepository::updateStatement ( const std::shared_ptr< core::domain::Statement > & statement)
overridevirtual

Update an existing statement.

Parameters
statementStatement to update.

Implements core::ports::repositories::IStatementRepository.

Definition at line 165 of file SqliteStatementRepository.cpp.

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

◆ upsertStatement()

void SqliteStatementRepository::upsertStatement ( const std::shared_ptr< core::domain::Statement > & statement)
overridevirtual

Insert or update a statement.

Parameters
statementStatement to upsert.

Implements core::ports::repositories::IStatementRepository.

Definition at line 183 of file SqliteStatementRepository.cpp.

Here is the call graph for this function:

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