mrtinydbutils.middlewares – Middlewares for TinyDB¶
TinyDB Middelware Classes.
Module author: Michael Rippstein <michael@anatas.ch>
DocIdToEntryMiddleware¶
- class mrtinydbutils.middlewares.DocIdToEntryMiddleware(storage_cls)[source]¶
Bases:
tinydb.middlewares.MiddlewareAdd the doc_id to every entry.
It adds the doc_id to every entry at the reading and removing it at the writing of the the table. The doc_id is stored with the key definded in the class attribute doc_id_key.
Warning
If the key exists in the document it will overwriten!