Categories > Data structure > rex_nedb

Introduction

Asynchronous database.

Links


Categories > Data structure > rex_nedbIntroductionLinksDependenceUsageStorage typeWriteInsert rows by CSVData typeInsert rows by JSONSave rowUpdate rowsRemoveReadRead all rowsQueryingRead all queried rowsRetrieve queried rowsDatabase referenceSave & loadDebug panel

Dependence

None

Usage

Storage type

Write

2. Callback
1. Insert rows
Yes
No
Is action
successful
Condition:On update
Condition:On update error
Expression:LastErrorMessage
Action:Insert CSV data
Action:Insert JSON data

Insert rows by CSV

Sample capx

  1. Action:Insert CSV data

    • First row : name of keys
    • Other rows : data
  1. Callback

    • Trigger Condition:On update, or

    • Trigger Condition:On update error

      • `Expression:LastErrorMessage
Data type

Property Eval mode

Insert rows by JSON

Sample capx

  1. Action:Insert JSON data

  2. Callback

    • Trigger Condition:On update, or

    • Trigger Condition:On update error

      • Expression:LastErrorMessage

Save row

3. Callback
2. Save
1. Prepare row
Yes
Found
No
Yes
Found
Not found
No
Yes
No
Is action
successful
Condition:On update
Condition:On update error
Expression:LastErrorMessage
Action:Save
Set value
----
Action:Set value
Set row ID
----
Action:Set row ID
Action:Set row index
Set index key
----
Action:Set value
Has
Row Id
Find row
by rowID
Update row
Has index key
Find row
by index key
Insert new row

Sample capx

  1. prepare row

    • Save data at a specific row, i.e. pick row then update it

      • Action:Set row ID, or Action:Set row index

      • Action:Set value , to set value of index key

        • Index keys : a set of keys which the values are unique.

          • Property Index keys, or Action:Set index keys.
          • Multiple keys are separated by ,, for example
           
          xxxxxxxxxx
          UID,VarName
    • Other keys

      • Action:Set value

        • options: if greater , if less
      • Action:Set boolean value

      • Action:Set JSON

      • Action:Add to

  2. Action:Save

    • Expression:LastSavedRowID

    • Pick row by rowID

      • Update row if found
    • Else

      • Pick row by index keys

        • Update row, if found, or
        • Insert new row
  3. Callback

    • Trigger Condition:On update, or

    • Trigger Condition:On update error

      • Expression:LastErrorMessage

Update rows

1. Build filter and prepare row
2. Update
3. Callback
Yes
No
Build filter
----
Action:1. New
Action:2. value compare
...
Prepare row
----
Action:Set value
...
Action:Update queried rows
Is action
successful
Condition:On update
Condition:On update error
Expression:LastErrorMessage

Sample capx

  1. Build filter and prepare row

    • Build filter

      1. Action:1. New
      2. Action:2. value compare
      3. ...
    • Prepare row

      1. Action:Set value
      2. ...
  2. Action:Update queried rows

  3. Callback

    • Trigger Condition:On update, or

    • Trigger Condition:On update error

      • Expression:LastErrorMessage

Remove

2. Callback
1. Remove rows
Yes
No
Is action
successful
Condition:On remove rows
Condition:On remove rows error
Expression:LastErrorMessage
Remove rows
----
Action:Remove by row ID
Action:Remove all
Action:Remove queried rows
Action:Remove by row index
  1. remove rows

    • Action:Remove by row ID
    • Action:Remove all
    • Action:Remove queried rows
    • Action:Remove by row index
  2. Callback

    • Trigger Condition:On remove rows, or

    • Trigger Condition:On remove rows error

      • Expression:LastErrorMessage

Read

Read all rows

Querying

5. Callback
4. Load
1,2,3 Build filter
Yes
No
Is action
successful
Condition:On load rows
Condition:On load rows error
Expression:LastErrorMessage
Queried rows
----
Expression:QueriedRowsAsJSON
Expression:Index2QueriedRowContent(index)
Expression:QueriedRowsCount
Condition:For each row
Expression:CurRowContent
Expression:CurRowIndex
Action:Load queried rows
New filter
----
Action:1. New
Value comparison
----
Action:2. value compare
Action:2. boolean value compare
Action:2. regex matched
Current filter
Sort
----
Action:3. order

Sample capx

  1. Create a new filter, or start from current filter (sample capx), if it does not create a new filter.

    • Action:1. New
  2. Add conditions, or get all row, if no conditions assigned.

    • Action:2. value compare
    • Action:2. boolean value compare
    • Action:2. regex matched
  3. sort

    • Action:3. order, or Condition:3. order
  4. Load

    • Action:Load queried rows
  5. Callback

    • Trigger Condition:On load rows, or

    • Trigger Condition:On load rows error

      • `Expression:LastErrorMessage
Read all queried rows
Retrieve queried rows

Sample capx

Condition:For each row

Get queried row by index from 0 to Expression:QueriedRowsCount-1 (sample capx)


Database reference

Sample capx

Property Database name


Save & load

It supports official saving & loading feature when using Disk storage mode, queried rows will also be saved.


Debug panel

All rows will be shown at debug panel in JSON format.