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

#include <SqliteActorRepository.h>

Inheritance diagram for SqliteActorRepository:
Collaboration diagram for SqliteActorRepository:

Classes

struct  Impl

Public Member Functions

 SqliteActorRepository (const std::string &dbPath)
 Create an actor repository for the database at the given path.
 SqliteActorRepository (std::shared_ptr< SqliteDb > db)
 Create an actor repository using an existing database handle wrapper.
 ~SqliteActorRepository () override
 Destroy the repository.
void addActor (const std::shared_ptr< core::domain::Actor > &actor) override
 Insert a new actor.
std::vector< std::shared_ptr< core::domain::Actor > > getActors () const override
 Retrieve all actors.
std::optional< std::shared_ptr< core::domain::Actor > > getActorById (const std::string &id) const override
 Retrieve an actor by identifier.
void removeActor (const std::string &id) override
 Remove an actor by identifier.
void updateActor (const std::shared_ptr< core::domain::Actor > &actor) override
 Update an existing actor.
void upsertActor (const std::shared_ptr< core::domain::Actor > &actor) override
 Insert or update an actor.
void clearActors () override
 Remove all actors.
sqlite3 * sqliteHandle () const noexcept override
 Return the SQLite handle.
Public Member Functions inherited from core::ports::repositories::IActorRepository
virtual ~IActorRepository ()=default
 Destroy the actor repository interface.
Public Member Functions inherited from ISqlConnectionProvider
virtual ~ISqlConnectionProvider ()=default

Detailed Description

Definition at line 16 of file SqliteActorRepository.h.

Constructor & Destructor Documentation

◆ SqliteActorRepository() [1/2]

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

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

Parameters
dbPathSQLite database path.

Definition at line 160 of file SqliteActorRepository.cpp.

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

◆ SqliteActorRepository() [2/2]

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

Create an actor repository using an existing database handle wrapper.

Parameters
dbShared SQLite database wrapper.

Definition at line 163 of file SqliteActorRepository.cpp.

◆ ~SqliteActorRepository()

SqliteActorRepository::~SqliteActorRepository ( )
overridedefault

Destroy the repository.

Member Function Documentation

◆ addActor()

void SqliteActorRepository::addActor ( const std::shared_ptr< core::domain::Actor > & actor)
overridevirtual

Insert a new actor.

Parameters
actorActor to add.

Implements core::ports::repositories::IActorRepository.

Definition at line 174 of file SqliteActorRepository.cpp.

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

◆ clearActors()

void SqliteActorRepository::clearActors ( )
overridevirtual

Remove all actors.

Implements core::ports::repositories::IActorRepository.

Definition at line 292 of file SqliteActorRepository.cpp.

◆ getActorById()

std::optional< std::shared_ptr< Actor > > SqliteActorRepository::getActorById ( const std::string & id) const
overridevirtual

Retrieve an actor by identifier.

Parameters
idActor identifier.
Returns
Actor with the requested identifier, if found.

Implements core::ports::repositories::IActorRepository.

Definition at line 217 of file SqliteActorRepository.cpp.

Here is the call graph for this function:

◆ getActors()

std::vector< std::shared_ptr< Actor > > SqliteActorRepository::getActors ( ) const
overridevirtual

Retrieve all actors.

Returns
All stored actors.

Implements core::ports::repositories::IActorRepository.

Definition at line 195 of file SqliteActorRepository.cpp.

Here is the call graph for this function:

◆ removeActor()

void SqliteActorRepository::removeActor ( const std::string & id)
overridevirtual

Remove an actor by identifier.

Parameters
idActor identifier.

Implements core::ports::repositories::IActorRepository.

Definition at line 243 of file SqliteActorRepository.cpp.

Here is the call graph for this function:

◆ sqliteHandle()

sqlite3 * SqliteActorRepository::sqliteHandle ( ) const
overridevirtualnoexcept

Return the SQLite handle.

Returns
SQLite database handle.

Implements ISqlConnectionProvider.

Definition at line 302 of file SqliteActorRepository.cpp.

◆ updateActor()

void SqliteActorRepository::updateActor ( const std::shared_ptr< core::domain::Actor > & actor)
overridevirtual

Update an existing actor.

Parameters
actorActor to update.

Implements core::ports::repositories::IActorRepository.

Definition at line 258 of file SqliteActorRepository.cpp.

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

◆ upsertActor()

void SqliteActorRepository::upsertActor ( const std::shared_ptr< core::domain::Actor > & actor)
overridevirtual

Insert or update an actor.

Parameters
actorActor to upsert.

Implements core::ports::repositories::IActorRepository.

Definition at line 281 of file SqliteActorRepository.cpp.

Here is the call graph for this function:

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