DatabaseObject

DatabaseObject

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.

Members

id :string

Type:
  • string

type :string

Type:
  • string

Methods

delete() → {Promise.<void>}

Delete this DatabaseObject record.

Returns:
Type
Promise.<void>

get(prop) → {any}

Get a value from the DatabaseObject.

Parameters:
Name Type Description
prop string

The name of the prop.

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.

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.

Returns:

The DatabaseObject.

Type
DatabaseObject

toJSON() → {any}

Get a simple object representation of the DatabaseObject.

Returns:

The DatabaseObject as a normal object.

Type
any