Class: Record

Record


new Record(props, opts)

js-data's Record class.

import {Record} from 'js-data'
Parameters:
Name Type Argument Description
props Object <optional>

The initial properties of the new Record instance.

opts Object <optional>

Configuration options.

Properties
Name Type Argument Default Description
noValidate boolean <optional>
false

Whether to skip validation on the initial properties.

Source:

Extends

Methods


afterLoadRelations(relations, opts)

TODO

Parameters:
Name Type Description
relations Array.<string>

TODO

opts Object

TODO

Source:

afterSave(opts)

TODO

Parameters:
Name Type Description
opts Object

TODO

Source:

beforeLoadRelations(relations, opts)

TODO

Parameters:
Name Type Description
relations Array.<string>

TODO

opts Object

TODO

Source:

beforeSave(opts)

TODO

Parameters:
Name Type Description
opts Object

TODO

Source:

changes(opts)

Return changes to this record since it was instantiated or Record#commit was called.

Parameters:
Name Type Argument Description
opts <optional>

Configuration options.

Properties
Name Type Argument Description
equalsFn function <optional>

Equality function. Default uses ===.

ignore Array <optional>

Array of strings or RegExp of fields to ignore.

Source:

commit()

TODO

Source:

create(opts)

TODO

Parameters:
Name Type Argument Description
opts Object <optional>

Configuration options. See Mapper#create.

Source:

dbg()

Inherited From:
Source:

destroy(opts)

TODO

Parameters:
Name Type Argument Description
opts Object <optional>

Configuration options. @see Model.destroy.

Source:

get(key)

Return the value at the given path for this instance.

Parameters:
Name Type Description
key string

Path of value to retrieve.

Source:
Returns:

Value at path.

Type
*

hasChanges(opts)

Return whether this record has changed since it was instantiated or Record#commit was called.

Parameters:
Name Type Argument Description
opts <optional>

Configuration options.

Properties
Name Type Argument Description
equalsFn function <optional>

Equality function. Default uses ===.

ignore Array <optional>

Array of strings or RegExp of fields to ignore.

Source:

hashCode()

TODO

Source:

loadRelations(relations, opts)

TODO

Parameters:
Name Type Argument Description
relations Array.<string> <optional>

TODO

opts Object <optional>

TODO

Source:

log()

Inherited From:
Source:

previous(key)

TODO

Parameters:
Name Type Argument Description
key string <optional>

TODO

Source:

revert(opts)

TODO

Parameters:
Name Type Argument Description
opts Object <optional>

Configuration options.

Source:

save(opts)

Delegates to Mapper#update.

Parameters:
Name Type Argument Description
opts Object <optional>

Configuration options. See Mapper#create.

Source:

set(key, value, opts)

Set the value for a given key, or the values for the given keys if "key" is an object.

Parameters:
Name Type Argument Description
key string | Object

Key to set or hash of key-value pairs to set.

value * <optional>

Value to set for the given key.

opts Object <optional>

Optional configuration.

Properties
Name Type Argument Default Description
silent boolean <optional>
false

Whether to trigger change events.

Source:

toJSON(opts)

Return a plain object representation of this record. If the class from which this record was created has a mapper, then Mapper#toJSON will be called instead.

Parameters:
Name Type Argument Description
opts Object <optional>

Configuration options.

Properties
Name Type Argument Description
with Array.<string> <optional>

Array of relation names or relation fields to include in the representation. Only available as an option if the class from which this record was created has a mapper.

Source:
Returns:

Plain object representation of this record.

Type
Object

unset(key, opts)

Unset the value for a given key.

Parameters:
Name Type Argument Description
key string

Key to unset.

opts Object <optional>

Optional configuration.

Properties
Name Type Argument Default Description
silent boolean <optional>
false

Whether to trigger change events.

Source: