Skip to content

Commit

Permalink
cria arquitetura referente à busca por string #30
Browse files Browse the repository at this point in the history
  • Loading branch information
vitin-m committed Mar 28, 2023
1 parent 39d4c43 commit 7b92468
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/SearchEngine/application/unit_of_work.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from ..infrastructure.ComponentManagment.SQL_alchemy_repository import (
SQLAlchemyRepository,
)
from ..infrastructure.dataframe_repository import DataFrameRepository


class MockUnitOfWork(AbstractUnitOfWork):
Expand All @@ -28,3 +29,15 @@ def commit(self):

def rollback(self):
pass


class DataFrameUnitOfWork(AbstractDBUnitOfWork):
def __init__(self, path):
self.repository = DataFrameRepository(path)
self.commited = False

def commit(self):
self.commited = True

def rollback(self):
pass
21 changes: 21 additions & 0 deletions src/SearchEngine/domain/repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,24 @@ def _get(self, **kwargs):

def __repr__(self):
raise NotImplemented


class IDataFrameRepository(AbstractRepository, metaclass=ABCMeta):
@abstractmethod
def __init__(self) -> None:
raise NotImplemented

@abstractmethod
def _add(self, component: Component):
raise NotImplemented

@abstractmethod
def _get_by_uid(self, ref: UUID):
raise NotImplemented

@abstractmethod
def _get(self, **kwargs):
raise NotImplemented

def __repr__(self) -> str:
return NotImplemented

0 comments on commit 7b92468

Please sign in to comment.