moobius.database.json_database#
Module-level functions#
(No module-level functions)
Class JSONDatabase#
JSONDatabase simply stores information as JSON strings in a list of files. Each domain, key combination is stored as one file. Dataclass objects can be seralized as well.
JSONDatabase.get_value#
Gets the value (which is a dict). Note: This “key” is different from a key to look up a CachedDict file. Note: This function should not be called directly.
**JSONDatabase.get_value**(self, key)
__key:__ String-valued key.
The is_sucessful, the_value.
TypeError: If the type of the value is unknown, so we can’t construct the object.
JSONDatabase.set_value#
Updates and saves a cached dict,.
**JSONDatabase.set_value**(self, key, value)
__key:__ String-valued key.
__value:__ A dict-valued value.
(is_success, the key).
Note: This function should not be called directly.
(this function does not raise any notable errors)
JSONDatabase.delete_key#
Deletes a cached dict.
**JSONDatabase.delete_key**(self, key)
__key:__ Key.
(True, the key)
Note: This function should not be called directly.
(this function does not raise any notable errors)
JSONDatabase.all_keys#
Gets all the cached dicts in the database.
**JSONDatabase.all_keys**(self)
__(this class constructor accepts no arguments):__
The dicts as an iterable which internally uses yield().
(this function does not raise any notable errors)
Class attributes#
JSONDatabase.DatabaseInterface