piermesh/docs/Daisy/Daisy.md

64 lines
1.5 KiB
Markdown
Raw Normal View History

2024-08-01 21:09:50 +00:00
![Daisy logo](https://git.utopic.work/PierMesh/piermesh/raw/branch/main/imgs/daisydisplay.png)
2024-08-02 04:27:56 +00:00
<a id="daisy"></a>
# Daisy
2024-08-01 01:09:11 +00:00
2024-11-26 17:43:02 +00:00
### *class* Daisy.Daisy.Daisy(filepath: str, daisyCryptography, templates: dict = {}, template: bool = False, prefillDict: bool = False, remote=False)
2024-08-01 01:09:11 +00:00
Base class for Daisy data representation
[🔗 Source](https://git.utopic.work/PierMesh/piermesh/src/branch/main/Components/daisy.py)
#### filepath
Path to file representation on disk
* **Type:**
str
#### msg
In memory representation
* **Type:**
dict
#### get()
Get record dictionary from memory
* **Returns:**
**self.msg**
* **Return type:**
dict
2024-11-26 17:43:02 +00:00
#### json_to_msg(path: str)
Convert json at the path plus .json to a msgpack binary
* **Parameters:**
**path** (*str*) Path to json minus the extension
2024-08-01 01:09:11 +00:00
#### read(decrypt: bool = False, decryptKey=False)
Read record from disk to memory
* **Parameters:**
* **decrypt** (*bool*) Whether to decrypt record
* **decryptKey** Key to decrypt record
#### sublist()
Lists contents of directory if object is a directory, otherwise return None
#### write(override=False, encrypt: bool = False, encryptKey=None, recur: bool = False)
2024-11-26 17:43:02 +00:00
Write record to disk, note: use override with updated record to update record
2024-08-01 01:09:11 +00:00
* **Parameters:**
* **override** Either false or a dictionary of values to set on the record
* **encrypt** (*bool*) Whether to encrypt the record (TODO)
* **encryptKey** Key to encrypt record with, or None if not set
* **recur** (*bool*) Whether to recursively handle keys