Asynchronous database.
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
None
Persistence : store database in disk
Set property Storage
to Disk
. and
Set Database name
to a non-empty string
Database name
is ""
, an empty string.In memory : store database in memory
Storage
to In memory
.Action:Insert CSV data
Callback
Trigger Condition:On update
, or
Trigger Condition:On update error
`Expression:LastErrorMessage
Property Eval mode
No
: string
Action:Define type
: define a column to be number type (Sample capx)Yes
: parse value by eval function of javascrpt
10
'hi'
Math.random()
For example,
xxxxxxxxxx
Name,HP,MP
'aaa',100,20
'bbb',80,30
will insert 2 rows.
Error message will display on console when eval failed.
Action:Insert JSON data
Callback
Trigger Condition:On update
, or
Trigger Condition:On update error
Expression:LastErrorMessage
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.
Index keys
, or Action:Set index keys
. ,
, for example xxxxxxxxxx
UID,VarName
Other keys
Action:Set value
if greater
, if less
Action:Set boolean value
Action:Set JSON
Action:Add to
Action:Save
Expression:LastSavedRowID
Pick row by rowID
Else
Pick row by index keys
Callback
Trigger Condition:On update
, or
Trigger Condition:On update error
Expression:LastErrorMessage
Build filter and prepare row
Build filter
Action:1. New
Action:2. value compare
Prepare row
Action:Update queried rows
Callback
Trigger Condition:On update
, or
Trigger Condition:On update error
Expression:LastErrorMessage
remove rows
Action:Remove by row ID
Action:Remove all
Action:Remove queried rows
Action:Remove by row index
Callback
Trigger Condition:On remove rows
, or
Trigger Condition:On remove rows error
Expression:LastErrorMessage
Expression:AllRowsAsJSON
, all rows in JSON stringExpression:AllRowsCount
Create a new filter, or start from current filter (sample capx), if it does not create a new filter.
Action:1. New
Add conditions, or get all row, if no conditions assigned.
Action:2. value compare
Action:2. boolean value compare
Action:2. regex matched
sort
Action:3. order
, or Condition:3. order
Load
Action:Load queried rows
Callback
Trigger Condition:On load rows
, or
Trigger Condition:On load rows error
`Expression:LastErrorMessage
Expression:QueriedRowsAsJSON
, all queried rows in JSON stringExpression:QueriedRowsCount
Expression:QueriedSum( key )
Expression:QueriedMin( key )
Expression:QueriedMax( key )
Condition:For each row
Expression:CurRowContent
Expression:CurRowContent
, returns key-value pairs of current row in JSON stringExpression:CurRowContent( key )
, returns the value of a specific key, or 0 if the key does not existExpression:CurRowContent( key, defaultValue )
, returns the value of a specific key, or defaultValue
if the key does not exist.Expression:CurRowIndex
Get queried row by index from 0 to Expression:QueriedRowsCount
-1 (sample capx)
Expression:Index2QueriedRowContent( index )
, returns key-value pairs of the specific row in JSON string
Expression:Index2QueriedRowContent( index, key )
, returns the value of a specific key, or 0 if the key does not exist
Expression:Index2QueriedRowID( index )
, returns rowID of the specific rowExpression:Index2QueriedRowContent( index, key, defaultValue )
, returns the value of a specific key, or defaultValue
if the key does not exist.
Property Database name
Empty string ""
: private database, destroyed when instance had been destroyed
Not empty string : a global database indexed by this Database name
property
It supports official saving & loading feature when using Disk
storage mode, queried rows will also be saved.
All rows will be shown at debug panel in JSON format.