Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RecordV2DataTypeImpl

A data type for RecordV2 values

Hierarchy

Implements

Index

Constructors

constructor

Properties

RecordV2

RecordV2: RecordV2Impl = RecordV2Impl

The implementation of the underlying value type

Private validator

validator: (value: RecordV2Impl) => void

A validator for validating RecordV2 instances.

param

the record to validate

throws

an error if the value is not valid

Type declaration

Readonly valueClass

valueClass: {}

The constructor function creating the value type

param

the arguments to the constructor

returns

a new value object

Type declaration

Methods

binaryDeltaType

canReadAs

  • canReadAs(valueClass: {}): boolean
  • inheritdoc

    Parameters

    • valueClass: {}

    Returns boolean

deltaType

from

  • Create a new RecordV2 instance from data

    Parameters

    • value: RecordV2

      the CBOR data containing the record

    Returns RecordV2Impl

    a new RecordV2 instance

name

  • name(): string
  • The external type identifier.

    Returns string

    the name of this datatype

parseSchema

  • Parse a JSON string into a RecordV2 schema

    parame

    the schema parsed from the JSON string

    Parameters

    • json: string

      the JSON string

    Returns SchemaImpl

readAs

  • readAs<T>(valueClass: {}, buffer: Uint8Array | Bytes, offset?: undefined | number, length?: undefined | number): T
  • inheritdoc

    Type parameters

    • T

    Parameters

    • valueClass: {}
    • buffer: Uint8Array | Bytes
    • Optional offset: undefined | number
    • Optional length: undefined | number

    Returns T

readValue

  • readValue(buffer: Uint8Array | Bytes, offset?: undefined | number, length?: undefined | number): RecordV2 | null
  • inheritdoc

    Parameters

    • buffer: Uint8Array | Bytes
    • Optional offset: undefined | number
    • Optional length: undefined | number

    Returns RecordV2 | null

schemaBuilder

toBytes

  • Convert a value to bytes

    throws

    an error if the supplied value could not be converted

    Parameters

    Returns Bytes

    a CBOR representation of the value

toString

  • toString(): string
  • Convert the objet to a string

    Returns string

    a string representation of the AbstractDataType

valueBuilder

  • Create a new value builder that can be used to build a RecordV2 value

    Returns RecordV2BuilderImpl

    a new value builder

withSchema

  • Create a new RecordV2DataTypeImpl with a schema.

    Parameters

    • schema: Schema

      the schema to validate against

    Returns RecordV2DataTypeImpl

    a new RecordV2 Data Type

writeValue

  • writeValue(value: RecordV2 | undefined | null): Buffer
  • Serialise a value to binary

    throws

    an IllegalArgumentError if the value cannot be serialised

    deprecated

    since version 6.11. Buffer has been replaced by Uint8Array. Use writeValueToArray instead. This will be removed in a future release.

    Parameters

    • value: RecordV2 | undefined | null

      the value to serialise. For primitive and JSON datatypes the value can be undefined or null. In this case a null value will be serialised.

    Returns Buffer

    the serialised value as a buffer

writeValueToArray

  • writeValueToArray(value: RecordV2 | undefined | null): Uint8Array
  • Serialise a value to binary

    throws

    an IllegalArgumentError if the value cannot be serialised

    Parameters

    • value: RecordV2 | undefined | null

      the value to serialise. For primitive and JSON datatypes the value can be undefined or null. In this case a null value will be serialised.

    Returns Uint8Array

    the serialised value as a buffer

Copyright © 2025 DiffusionData Ltd. All Rights Reserved.