nofeardb.orm.Document
- class nofeardb.orm.Document
Bases:
objectBase class for all documents that should be stored in the database
- create_snapshot()
Creates a snapshot of the data for restore purposes
- classmethod get_document_name()
Get the name by which the document is identified in the database
- Returns
Name of the document
- Return type
str
- get_hash()
Calculates the hash value for the document
- Returns
Hash value for all attributes
- Return type
str
- reset()
Restores the last snapshot
- set_relationship_added(rel_name: str, document: Document)
Set a relationship in added state
- Parameters
rel_name (str) – Name of the relationship
document (
Document) – Document which should be related
- set_relationship_removed(rel_name: str, document: Document)
Set a relationsip in removed state
- Parameters
rel_name (str) – Name of the relationship
document (
Document) – Document which is related
- validate() List[str]
Validates the object and returns a list of found errors
- Returns
List of all found errors
- Return type
str, list