Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface RecordV2

An immutable value representing a list of records.

See RecordV2DataType for details

since

6.0

Hierarchy

Index

Methods

asBuffer

  • asBuffer(): Buffer
  • Get a copy of the buffer containing this value.

    Returns Buffer

    This value in binary form

asFields

  • asFields(): string[]
  • 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 string[]

    a new mutable list of all the fields

asModel

  • 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 asValidatedModel method may be used instead.

    Parameters

    • schema: Schema

      the schema to use for parsing the data

    Returns RecordModel

    an immutable model derived from the data content

asRecords

  • asRecords(): string[][]
  • Returns the data content as an Array of Arrays of strings.

    Example:

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

    Returns string[][]

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

asValidatedModel

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

    The data is validated against the schema

    Parameters

    • schema: Schema

      the schema to use for parsing the data

    Returns RecordModel

    an immutable model derived from the data content

copyTo

  • copyTo(target: Buffer, offset?: undefined | number): void
  • Copy the binary data to a provided buffer.

    Parameters

    • target: Buffer

      the buffer to copy data to

    • Optional offset: undefined | number

      the position in the target buffer at which data will be copied

    Returns void

diff

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

    Parameters

    • original: RecordV2

      the original value to compare with this value

    Returns RecordV2Delta

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

length

  • length(): number
  • Get the number of bytes

    Returns number

    The length of the data in bytes