doc: rephrase jsshDB intro

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2021-02-21 08:16:33 +01:00
parent ac71000519
commit 17efeeb903

View File

@ -1007,11 +1007,11 @@ Usually a message is automatically forwarded from within `commands.sh`, but you
### jsshDB ### jsshDB
Since output generated by `JSON.sh` is so easy to use in bash, bashbot uses the format for a simple keys/value file store also. Output generated by `JSON.sh` can easily converted to bash associative arrays. Therefore Bashbot use this format for key/value file store too.
#### fast and slow operations #### fast and slow operations
jsshDB files are flat text files containing key/value pairs in the `JSON.sh` format. jsshDB files are flat text files containing key/value pairs in `JSON.sh` format.
Key/value pairs appearing later in the file overwrites earlier key/value pairs, Bashbot use this behavior to implement "fast replace" file operations. Key/value pairs appearing later in the file overwrites earlier key/value pairs, Bashbot use this behavior to implement "fast replace" file operations.
"fast functions" add a new key/value pair to the end of a file without deleting an existing one, this is fast but over time the file grows to infinity. "fast functions" add a new key/value pair to the end of a file without deleting an existing one, this is fast but over time the file grows to infinity.
@ -1138,7 +1138,7 @@ Something wrong with data-bot-bash/../../../somevalues
##### jssh_writeDB ##### jssh_writeDB
Write content of an ARRAY into jsshDB file. ARRAY name must be declared with `declare -A ARRAY` before calling writeDB. Write content of an ARRAY into jsshDB file. ARRAY name must be declared with `declare -A ARRAY` before calling writeDB.
"DB" file MUST exist or nothing is written. if "DB" file does not exist nothing is written.
Note: Existing content is overwritten. Note: Existing content is overwritten.
@ -1195,10 +1195,8 @@ jssh_printDB READVALUES
``` ```
##### jssh_updateDB ##### jssh_updateDB
Update/Add content of an ARRAY into a jsshDB file. ARRAY name must be declared with `declare -A ARRAY` before calling updateDB. `jssh_updateDB updates key/value pairs of an ARRAY in a jsshDB file. ARRAY name must be declared with `declare -A ARRAY` before calling updateDB.
"DB" file MUST exist or nothing is written. if "DB" file does not exist nothing is written.
Note: Existing content not in ARRAY is kept in file.
*usage:* jssh_updateDB "ARRAY" "filename" *usage:* jssh_updateDB "ARRAY" "filename"
@ -1675,5 +1673,5 @@ The name of your bot is available as bash variable "$ME", there is no need to ca
#### [Prev Best Practice](5_practice.md) #### [Prev Best Practice](5_practice.md)
#### [Next Notes for Developers](7_develop.md) #### [Next Notes for Developers](7_develop.md)
#### $$VERSION$$ v1.45-dev-42-g1a0642b #### $$VERSION$$ v1.45-dev-43-gac71000