pcah/python-clean-architecture

InMemoryDao

Closed this issue · 2 comments

lhaze commented
  • represents contents of a file
  • uses a loader, eg: pca.utils.serialization.CustomLoader or a json.loads/dumps
  • often used to store configuration (data less structured and more slowly changeable than contents DB and yet still not the codebase)
  • can use read-only mode
  • can be whole loaded into memory on application startup or lazy loaded on demand
lhaze commented

As issue #22 makes usage of files as DAO possible & quite simple, it introduces a new dependency: tinydb. But still, there might be a place for own file DAO:

  • As a framework, PCA should minimize the number of dependencies.
  • There is a need for read-only DAO for things that change slower than the contents of the DBs, and yet they are changable - like settings, but in a shape of domain entities.
  • It should be possible to load the entities from different types of files: yaml, json or ini.
lhaze commented

During implementation, I've decided that loading contents is not the responsibility of the DAO. Loading DTOs (dicts) from some kind of a file is the case for pca.utils.serialization, and pushing them into DAO should be done at the time of the DI registration. Whatever type of DAO it is -- not necessarily InMemoryDao.

So IMO the work here is done.