Interface GetOptions<DataType>

Options for retrieving and storing data in the SDK collections.

interface GetOptions {
    defaultValue?: DataType;
    deserializer?(valueToDeserialize): unknown;
    reconstructor?(value): DataType;
    serializer?(valueToSerialize): Uint8Array;
}

Type Parameters

  • DataType

Properties

defaultValue?: DataType

A default value to return if the original value is not present or null.

Methods

  • A deserializer function to customize the deserialization of values after reading from NEAR storage for this call.

    Parameters

    • valueToDeserialize: Uint8Array

      The Uint8Array retrieved from NEAR storage to deserialize.

    Returns unknown

  • A constructor function to call after deserializing a value. Tipically this is a constructor of the class you are storing.

    Parameters

    • value: unknown

      The value returned from deserialization - either the provided deserializer or default deserialization function.

    Returns DataType

  • A serializer function to customize the serialization of the collection for this call.

    Parameters

    • valueToSerialize: unknown

      The value that will be serialized - either the DataType or a unknown value.

    Returns Uint8Array

Generated using TypeDoc