new DatabaseObject(databaseManager, type, dataopt, optionsopt)
Class representing a database object.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
databaseManager |
DatabaseManager | The DatabaseManager. |
||
type |
string | The type of this DatabaseObject. |
||
data |
any |
<optional> |
{} | The data to initialize this DataObject with. |
options |
DatabaseObjectOptions |
<optional> |
{} | The DatabaseObjectOptions. |
- Source:
Members
id :string
Type:
- string
- Source:
type :string
Type:
- string
- Source:
Methods
delete() → {Promise.<void>}
Delete this DatabaseObject record.
- Source:
Returns:
- Type
- Promise.<void>
get(prop) → {any}
Get a value from the DatabaseObject.
Parameters:
Name | Type | Description |
---|---|---|
prop |
string | The name of the prop. |
- Source:
Returns:
The value of the prop.
- Type
- any
(async) save(dataopt) → {Promise.<DatabaseObject>}
Save the DatabaseObject record.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
data |
any |
<optional> |
{} | Any new data to write to the DatabaseObject before saving. |
- Source:
Returns:
The DatabaseObject.
- Type
- Promise.<DatabaseObject>
set(prop, val) → {DatabaseObject}
Set a value of the DatabaseObject.
Parameters:
Name | Type | Description |
---|---|---|
prop |
string | The name of the prop. |
val |
any | The value to set. |
- Source:
Returns:
The DatabaseObject.
- Type
- DatabaseObject
toJSON() → {any}
Get a simple object representation of the DatabaseObject.
- Source:
Returns:
The DatabaseObject as a normal object.
- Type
- any