piermesh/docs/Components/daisy.md

93 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

![Daisy logo](https://git.utopic.work/PierMesh/piermesh/raw/branch/main/imgs/daisydisplay.png)
# Schemaless binary database
### *class* Components.daisy.Daisy(filepath: str, templates: dict = {}, template: bool = False, prefillDict: bool = False)
Base class for Daisy data representation
[🔗 Source](https://git.utopic.work/PierMesh/piermesh/src/branch/main/Components/daisy.py)
#### get()
Get record dictionary from memory
* **Returns:**
**self.msg**
* **Return type:**
dict
#### 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)
Write record to disk
* **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
### *class* Components.daisy.Cache(filepaths=None, cacheFile=None, path: str = 'daisy', walk: bool = False, isCatch: bool = False)
In memory collection of Daisy records
#### create(path: str, data: dict)
Create new record
* **Parameters:**
* **path** (*str*) Path to create record at
* **data** (*dict*) Data to populate record with
#### get(path: str)
Get record at path, else return False
path: str
: Path of record
#### refresh()
Reload from disk to memory
#### search(keydict: dict, strict: bool = True)
Search cache for record for records with values
keydict: dict
: Values to search for
strict: bool
: Whether to require values match
### *class* Components.daisy.Catch(path: str = 'catch', filepaths=None, catchFile=None, walk: bool = False)
Sub class of Cache for handling catchs
![image](https://git.utopic.work/PierMesh/piermesh/raw/branch/main/imgs/catchdisplay.png)
#### get(head: str, tail: str, fins=None)
Get catch by pieces
* **Parameters:**
* **head** (*str*) First part of catch (maximum: 4 characters)
* **tail** (*str*) Second part of catch (maximum: 16 characters)
* **fins** List of (maximum 8 characters) strings at the end of the catch oe None if none
#### sget(path: str)
Call Caches get to get record