Class: RecordV2

diffusion.datatypes. RecordV2


new RecordV2()

An immutable value representing a list of records.

Since:
  • 6.0
See:

Extends

Classes

MutableRecordModel
RecordModel
RecordV2Builder
Schema
SchemaBuilder

Methods


apply(delta)

Apply a delta to this Binary value to create a new value.

Convenient equivalent to: diffusion.datatypes.binary().deltaSupport(delta).apply(this, delta);

Parameters:
Name Type Description
delta Object

The binary delta to apply to this value

Inherited From:
Throws:

Error if the delta is invalid

Returns:

A new instance derived from applying the delta to this value

Type
diffusion.datatypes.Binary

asFields()

Returns the data content as a list of fields.

This disregards record boundaries. If there is more than one record, they are concatenated to produce a list of all of the fields.

This method would normally only be used when it is known that there is only one record.

Returns:

a new mutable list of all the fields

Type
Array.<String>

asModel(schema)

Parses the content into a model based upon a specified schema.

This assumes that data is compatible with the schema and does not do any validation. There is no need to validate the data if this has been done on entry or at the server. However, if the data is invalid then issues may occur when attempting to access it.

If it is not certain that the data is valid then the asValidateModel method may be used instead.

Parameters:
Name Type Description
schema diffusion.datatypes.RecordV2.Schema

the schema to use for parsing the data

Returns:

an immutable model derived from the data content

Type
diffusion.datatypes.RecordV2.RecordModel

asRecords()

Returns the data content as an Array of Arrays of strings.

Returns:

a new mutable list where each entry represents a record within the data

Type
Array.<Array.<String>>
Example
// Iterate across each record's fields
value.asRecords().forEach((record) => {
    record.forEach((field) => {
        console.log("Field value: " + field);
    });
});

asValidatedModel(schema)

Parses the content into a model based upon a specified schema.

Parameters:
Name Type Description
schema diffusion.datatypes.RecordV2.Schema

the schema to use for parsing the data

Returns:
  • a model derived from the content
Type
diffusion.datatypes.RecordV2.RecordModel

diff(original)

Compare this value with an earlier version to calculate a structural delta.

Parameters:
Name Type Description
original RecordV2

the original value to compare with this value

Overrides:
Returns:

a structural delta representing the difference between the original and this value

Type
RecordV2Delta

get()

Get the value as a Buffer.

Inherited From:
Returns:

The buffer value

Type
Buffer