FOSSredder 0.5.0
Loading...
Searching...
No Matches
SqliteContractRepository.h
Go to the documentation of this file.
1
5
6#pragma once
7
9#include <memory>
10#include <string>
11
12class SqliteDb;
13
16public:
21 explicit SqliteContractRepository(const std::string& dbPath);
22
28 explicit SqliteContractRepository(std::shared_ptr<SqliteDb> db);
29
34
39 void
40 addContract(const std::shared_ptr<core::domain::Contract>& contract) override;
41
46 std::vector<std::shared_ptr<core::domain::Contract>>
47 getContracts() const override;
48
54 std::optional<std::shared_ptr<core::domain::Contract>>
55 getContractById(const std::string& id) const override;
56
61 void removeContract(const std::string& id) override;
62
67 void updateContract(
68 const std::shared_ptr<core::domain::Contract>& contract) override;
69
74 void upsertContract(
75 const std::shared_ptr<core::domain::Contract>& contract) override;
76
80 void clearContracts() override;
81
87 std::vector<std::shared_ptr<core::domain::Contract>>
88 getContractsForActor(const std::string& actorId) const override;
94 std::vector<std::shared_ptr<core::domain::Contract>>
95 getContractsForProperty(const std::string& propertyId) const override;
101 std::vector<std::string>
102 getActorIdsForContract(const std::string& contractId) const override;
108 std::vector<std::string>
109 getPropertyIdsForContract(const std::string& contractId) const override;
110
111private:
112 struct Impl;
113 std::unique_ptr<Impl> pimpl_;
114};
Repository port for core::domain::Contract persistence operations.
std::vector< std::string > getPropertyIdsForContract(const std::string &contractId) const override
Retrieve property identifiers linked to a contract.
std::vector< std::string > getActorIdsForContract(const std::string &contractId) const override
Retrieve actor identifiers linked to a contract.
std::vector< std::shared_ptr< core::domain::Contract > > getContractsForActor(const std::string &actorId) const override
Retrieve contracts associated with a given actor.
void removeContract(const std::string &id) override
Remove a contract by identifier.
void updateContract(const std::shared_ptr< core::domain::Contract > &contract) override
Update an existing contract.
std::vector< std::shared_ptr< core::domain::Contract > > getContracts() const override
Retrieve all contracts.
void upsertContract(const std::shared_ptr< core::domain::Contract > &contract) override
Insert or update a contract.
std::vector< std::shared_ptr< core::domain::Contract > > getContractsForProperty(const std::string &propertyId) const override
Retrieve contracts associated with a given property.
void addContract(const std::shared_ptr< core::domain::Contract > &contract) override
Insert a new contract.
std::optional< std::shared_ptr< core::domain::Contract > > getContractById(const std::string &id) const override
Retrieve a contract by identifier.
~SqliteContractRepository() override
Destroy the repository.
SqliteContractRepository(const std::string &dbPath)
Create a contract repository for the database at the given path.
void clearContracts() override
Remove all contracts.